[Lazarus] multi step dialog

Tony Whyman tony.whyman at mccallumwhyman.com
Mon Aug 17 10:34:42 CEST 2015


On 17/08/15 07:59, Graeme Geldenhuys wrote:
> In fpGUI I simply use a PageControl and set TabPosition = None. In
> Delphi 5-7 and Kylix I used to do similar, but can't remember what exact
> control I used... might have been PageControl too.
>
> Regards,
>    - Graeme -
>


A TPageControl is also what I use to get a multi-step dialog.

Set "ShowTabs" to false and make each step a page in the pagecontrol. 
The Form's OnShow Handler should set the initial tab index e.g.

PageControl1.TabIndex := 0;

Place the forward/back buttons outside of the pagecontrol and make the 
body of each button's "OnClick" handler a case statement
e.g.

case PageControl1.TabIndex of
0: begin
       {validate}
      PageControl1.TabIndex := 1;
    end;
1: begin
       {validate}
      PageControl1.TabIndex := 2;
    end;
   ...
end;

The final step should set the ModalResult.

Use each page's "OnShow" handler to set button captions, if they need to 
change e.g. to change "Next" to "Finish" on the final tab,

Regards

Tony






More information about the Lazarus mailing list