RPC HELP TMult Order Example

From VistApedia
Revision as of 23:18, 3 July 2015 by Kdtop (talk | contribs) (Created page with "<h2>Order Example</h2> The following program code demonstrates how to get the next and previous elements in a TMult list: '''procedure''' TForm1.Button1Click(Sender: TOb...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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;