PROGRAM Paramscreen_Adv1;
{-- ***************************************************************************
-- ** Descr. : This script shows some advanced possiblities what you can do with
-- ** the TParamScreen Object. Together with the paramscreen_adv2.p2s
-- ** demo they show all possible Parameter Objects!
-- ***************************************************************************
-- ** 03/10/01 1.001.00 Initial Creation, sm@orcl-toolbox.com
-- ** 04/10/01 1.002.00 Added more documentation to the source, sm@orcl-toolbox.com
-- ***************************************************************************}
VAR
ps : TParamScreen;
pb : TParamBoard;
i : Integer;
//Begin Main
BEGIN
//Create a Parameterscreen object and default to not use old values from the
//previous run!
ps := TParamScreen.create(false);
//Add a board
pb := ps.AddBoard('Simple Types',picOptions);
//Add some items to the board
pb.addparam(parLabel,'MYLABEL','This is a label that can contain HTML! ... Please visit www.orcl-toolbox.com x2 for s script reference!','','');
pb.addparam(parString,'MYSTRING','Testinput','my test string!','');
//Make a nice seperator line above the MYSTRING parameter
ps.parambyname('MyString').isnewgroup := true;
pb.addparam(parCheckbox,'MYCHECKBOX','&Format Harddisk after succesfull run (just joking ;-)!)','Y','');
//for the integerfield just allow values between 1 and 10!
pb.addparam(parInteger,'MYINTEGER','Number of Objects','4','1-10');
// for the next parameters that are added, we want to have the old values
// from the previous run insteed of the default values!
ps.UseRegistry := true;
//Object oriented approach to add another board without using any variables
with ps.AddBoard('Simple List Types', picProperties) do
begin
addparam(parRadioGroup,'MYRG1','My Radio Group','16 colors','8 colors'+c_cr+'16 colors'+c_cr+'32 colors');
addparam(parComboBox,'MYCOMBO','combobox','16 colors','8 colors'+c_cr+'16 colors'+c_cr+'32 colors');
addparam(parComboListBox,'MYCOMBOLIST','listbox','16 colors','8 colors'+c_cr+'16 colors'+c_cr+'32 colors');
addparam(parMemo,'MYMEMO','Multiline','','');
end;
//Show the parameterscreen and check for the result to see if user canceled or not
if ps.ShowParamScreen('Hello!')=TRUE then
begin
//The user pressed OK
logadd('parameter values:');
for i := 0 to ps.paramcount-1 do
begin
logadd(ps.param[i].name+' : '+ps.param[i].value);
end;
end else
begin
//The user pressed CANCEL
logadd('Parameterscreen canceled!');
end;
//Just to be correct we have to free the Parameterscreen object.
//This is not absolutly necessary as all objects anyways get freed
//internally when the script finishes.
ps.free;
END.
//End Main