Working with parameter controls
The parameter identifier is
specified through the controls href tag in the anchor formatting.
This takes the format of : <A href="param
identifier">param value</A> Multiple parameter
identifiers can be used in the control but must be unique through
the control.
The controls provide an easy interface to get and set parameter
values with the Parameter[identifier:string]:string property.
Example :
Select your tool : <A
href="tool">Delphi</A> and OS : <A
href="os">Windows</A>
The parameter values can here be
obtained through :
var
os,tool:string;
tool:=control.Parameter['tool'];
os:=control.Parameter['os'];
The parameter values can be set through :
control.Parameter['tool']:='Kylix';
control.Parameter['os']:='Linux';
Several ways exist to let the user change the parameter value,
for which 3 events are used :
OnParamClick, OnParamList, OnParamPopup
OnParamClick :
This event returns the href and value of the parameter
clicked. The value can be changed in code.
Example 1 : (this toggles the value between Delphi &
C++Builder)
if (href='tool') and (value='Delphi') then value='C++Builder'
else value:='Delphi';
Example 2 : (this asks the user for the value)
if (href='os') the InputQuery('Operating system','Name',value);
OnParamList :
This event returns the href and value of the parameter clicked
and allows setting of the values that will appear in the dropdown
listbox. If the doPopup parameter is returned true, the dropdown
list will appear. The values of the list can be set through the
stringlist Values parameter.
Example :
doPopup:= (href='tool'); values.Add('Delphi'); values.Add('C++Builder'); values.Add('JBuilder');
OnParamPopup :
This event is similar to the OnParamList except that it controls
the popup menu for parameter selection. This event returns the
href and value of the parameter clicked and allows setting of the
values that will appear in the popup menu. If the doPopup
parameter is returned true, the popup menu will appear. The
values of the popup menu can be set through the stringlist Values
parameter.
Example :
doPopup:= (href='tool') or (href='os'); if (href='tool') then begin values.Add('Delphi'); values.Add('C++Builder'); values.Add('JBuilder'); end; if (href='os') then begin values.Add('Windows'); values.Add('Linux'); values.Add('Solaris'); end;