RPC HELP TMult Order Example
From VistApedia
Jump to navigationJump to search
Order Example
The following program code demonstrates how to get the next and previous elements in a TMult list:
procedure TForm1.Button1Click(Sender: TObject);
var
Mult: TMult;
Subscript: string;
begin
{Create Mult. Make Form1 its owner}
Mult := TMult.Create(Form1);
Mult['First'] := 'One';
{Store element pairs one by one}
Mult['Second'] := 'Two';
Mult['Third'] := 'Three';
Mult['Fourth'] := 'Four';
{Subscript will be Fourth}
Subscript := Mult.Order('Third',1);
{Subscript will be Second}
Subscript := Mult.Order('Third',-1);
{Subscript will be . THIRD subscript does not exist}
Subscript := Mult.Order('THIRD',1);
{Subscript will be First}
Subscript := Mult.Order(,1);
{Subscript will be Fourth}
Subscript := Mult.Order(,-1);
end;