Example for the parameters function

Make a new project in Delphi and just drop the UserDlg component on the form. To the Message property in the object inspector, assign the following 2 lines:

Hi :User,
nice to use our User dialog !

Note that the double-point at :User is very important to mark this word as a parameter.

Now replace the code of your unit by the following.

Run your project and you'll see what happens when using Parameters.

 

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  UserDlg;

type
  TForm1 = class(TForm)
    UserDlg1: TUserDlg;
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
 u : string ;
begin
     u := InputBox ('Question','Please enter your name','') ;

     { set the parameter User }
     UserDlg1.SetParam ('User',u) ;
     { alternatively, you could do
       UserDlg1.Params.Add ('User='+u) ;
       But this has the disadvantage that if you call this procedure
       twice or more, you set 2 or moore lines in the Params StringList.
       UserDlg1.SetParam takes care of that and ensures only one
       entry per parameter in the Params stringlist }

     UserDlg1.Show ;
end;

end.