RPC HELP TMult Position Example

From VistApedia
Jump to: navigation, search

RPC Broker Help Home

Position Example

Back

The following program code demonstrates how to get the position of an item in a TMult variable:


   procedure TForm1.Button1Click(Sender: TObject);
   var
     Mult: TMult;
   begin
     {Create Mult. Make Form1 its owner}
     Mult := TMult.Create(Form1);
     Label1.Caption := 'The position of the Third element is ' +
     {will be -1 since the list is empty}
     IntToStr(Mult.Postion('Third'));
     Mult['Second'] := 'Two';
     Label1.Caption := 'The position of the Third element is ' +
     {will be -1 since 'Third' item does not exit}
     IntToStr(Mult.Postion('Third'));
     Label1.Caption := 'The position of the Second element is ' +
     {will be 0, TMult positions start with 0}
     IntToStr(Mult.Postion('Second'));
   end;