Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

multi step dialog

21 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Santhoff

Hi,

is there any template like dialog having multiple steps the user switches with "next"/"previous"/"finish"-buttons?

Sth. like installer programs do for asking the user a lot of information: what to install, where to, accept licence, some config data, etc.

Maybe a source on LCCR or an example program has such code, I don't want to invent the world anew. ;)

TIA,
Marc

Marc Santhoff

Reply by email

Luiz Americo Pereira Camara
to Marc Santhoff

2015-08-16 11:33 GMT-03:00 Marc Santhoff :

Show quoted text 5 lines
Hi, is there any template like dialog having multiple steps the user switches with "next"/"previous"/"finish"-buttons?

https://code.google.com/p/luipack/source/browse/#svn%2Ftrunk%2Fluicontrols%2Fdemos%2Fwizard

The API is a bit cumbersome but works. Plan to improve the interface

Luiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150816/e423ee9d/attachment.html>

Reply by email

Mark Morgan Lloyd
to Marc Santhoff: is there any template like dialog having multiple steps the user switches with…
Marc Santhoff wrote 11 lines
Hi, is there any template like dialog having multiple steps the user switches with "next"/"previous"/"finish"-buttons? Sth. like installer programs do for asking the user a lot of information: what to install, where to, accept licence, some config data, etc. Maybe a source on LCCR or an example program has such code, I don't want to invent the world anew. ;)

I've done it (for a database connection) using a notebook with tabs at the top. The only significant complexity was due to having the buttons on each page since it meant that I had to fudge the default as I progressed through the sequence.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Marc Santhoff
to Luiz Americo Pereira Camara: 2015-08-16 11:33 GMT-03:00 Marc Santhoff : https://code.google.com/p/luipack/source/browse…
Luiz Americo Pereira Camara wrote 9 lines
2015-08-16 11:33 GMT-03:00 Marc Santhoff : > Hi, > > is there any template like dialog having multiple steps the user > switches with "next"/"previous"/"finish"-buttons? > https://code.google.com/p/luipack/source/browse/#svn%2Ftrunk%2Fluicontrols%2Fdemos%2Fwizard

Wow, very elaborated code. It's what I need, the only thing is it has itself and another package installed in the IDE. I'll try to use it dynamically wihtout installation, but that will take a while.

The API is a bit cumbersome but works. Plan to improve the interface

I cannot comment on that, yet.

Thank you!

Marc Santhoff

Reply by email

Marc Santhoff
to Mark Morgan Lloyd: I've done it (for a database connection) using a notebook with tabs at the top. The only…
Mark Morgan Lloyd wrote 17 lines
Marc Santhoff wrote: > Hi, > > is there any template like dialog having multiple steps the user > switches with "next"/"previous"/"finish"-buttons? > > Sth. like installer programs do for asking the user a lot of > information: what to install, where to, accept licence, some config > data, etc. > > Maybe a source on LCCR or an example program has such code, I don't want > to invent the world anew. ;) I've done it (for a database connection) using a notebook with tabs at the top. The only significant complexity was due to having the buttons on each page since it meant that I had to fudge the default as I progressed through the sequence.

Me too, back in the 90ies, using Delphi 1 or 2. That's why I hoped there may be a somewhat general implementation for such generic use case. Like the one Luiz made - but I have to try it, learn how to use it first.

Marc

Marc Santhoff

Reply by email

Graeme Geldenhuys
to Marc Santhoff
Marc Santhoff wrote
Me too, back in the 90ies, using Delphi 1 or 2.

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 -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Tony Whyman
to Graeme Geldenhuys
Graeme Geldenhuys wrote 7 lines
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

Reply by email

Graeme Geldenhuys
to Tony Whyman
Tony Whyman wrote 6 lines
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

Thanks Tony, that is exactly what I did in my Delphi/Kylix days.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Marc Santhoff
to Tony Whyman: A TPageControl is also what I use to get a multi-step dialog. Set "ShowTabs" to false and…
Tony Whyman wrote 33 lines
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. 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,

Thank you all, I know it is somewhat trivial looking code and it actually is somehow. But one has to watch the state not only for dialog pages but each and every input field, check consistency, and so on.

Plus it's a recurring task (like reading directory entries into a container - Delphi has a class for, lazarus not). It would have been nice if there were a template or the like.

And there is, Luiz made it. ;)

Have fun,
Marc

Marc Santhoff

Reply by email

Graeme Geldenhuys
to Marc Santhoff
Marc Santhoff wrote
Delphi has a class for, lazarus not

I honestly don't see the point of a dedicated "wizard" class, when the PageControl already does exactly what is needed. Like I said, it worked just fine as far back as the D5..D7 and Kylix days. Maybe the later Delphi staff simply didn't know about the ShowTabs property. ;-) But I guess Lazarus will eventually get such a class too - being a VCL clone and all.

Regards,
- Graeme -

Reply by email

Tony Whyman
to Graeme Geldenhuys: I honestly don't see the point of a dedicated "wizard" class, when the PageControl…
Graeme Geldenhuys wrote 6 lines
I honestly don't see the point of a dedicated "wizard" class, when the PageControl already does exactly what is needed. Like I said, it worked just fine as far back as the D5..D7 and Kylix days. Maybe the later Delphi staff simply didn't know about the ShowTabs property.;-) But I guess Lazarus will eventually get such a class too - being a VCL clone and all.

I would tend to agree - but perhaps what is missing from Lazarus is some better template forms. For example, Delphi always had a dialog box template and it is very frustrating when you need to build your own each time. True, it does have the ProjTemplates package to help you do this - and I do now have my own dialog box template - but this is buggy and not ideal for the novice user (memo to self, file that bug report on ProjTemplates failing to use your .lfm on form creation, plus the enhancement request for a template hierarchy).

Along with a standard dialog box template, Lazarus could certainly do
with a "wizard" frame template using a TPageControl.

Tony

Reply by email

Marc Santhoff
to Bart: Care to elaborate on that (in a new thread)? Bart
Bart wrote 7 lines
On 8/17/15, Marc Santhoff wrote: > Plus it's a recurring task (like reading directory entries into a > container - Delphi has a class for, lazarus not). It would have been > nice if there were a template or the like. Care to elaborate on that (in a new thread)?

Currently not, to be honest. I could not do much but discuss that topic.

To summarize on the wizard dialog:

- it sems to be a not-so-often occuring use case
- if asked about, a lot of programmers step forward telling "I've done it like this ..."
- if made flexible and useful for mostly any case the code is getting huge fast - see Luiz's implmentation

Regarding a TDirectory class I think the properties are the same. The difference is it's a very commen use case to read directories and files into acontainer.

And last but not least: it has to be taken into account that searching code and learning howto use it often takes as much time as to write something simple but working yourself.

Marc Santhoff

Reply by email

Mark Morgan Lloyd
to Tony Whyman: A TPageControl is also what I use to get a multi-step dialog. Set "ShowTabs" to false and…
Tony Whyman wrote 19 lines
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

With the caveat there that that can benefit from having frames support. Obviously that's not such an issue now, but I've still got a few programs knocking around which due to e.g. slightly dodgy database code I've not yet ported to the versions of Lazarus and FPC where this became reliable.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Bart
to Marc Santhoff: Currently not, to be honest. I could not do much but discuss that topic. To summarize on…
Marc Santhoff wrote 13 lines
On Mo, 2015-08-17 at 16:39 +0200, Bart wrote: > On 8/17/15, Marc Santhoff wrote: > > > Plus it's a recurring task (like reading directory entries into a > > container - Delphi has a class for, lazarus not). It would have been > > nice if there were a template or the like. > > Care to elaborate on that (in a new thread)? Regarding a TDirectory class I think the properties are the same. The difference is it's a very commen use case to read directories and files into acontainer.

You say that delphi has a class that does this.
Can you point me to the right place in Embarcaderos's DocWiki where this class is described?
This way we might start a cleanroom implementation for this.

B.t.w. You know that we have FindAllFiles procedure and a TFileSearcher class in LazFileUtils?

Bart

Reply by email

Marc Santhoff
to Bart
Bart wrote 20 lines
On 8/18/15, Marc Santhoff wrote: > On Mo, 2015-08-17 at 16:39 +0200, Bart wrote: >> On 8/17/15, Marc Santhoff wrote: >> >> > Plus it's a recurring task (like reading directory entries into a >> > container - Delphi has a class for, lazarus not). It would have been >> > nice if there were a template or the like. >> >> Care to elaborate on that (in a new thread)? > > Regarding a TDirectory class I think the properties are the same. The > difference is it's a very commen use case to read directories and files > into acontainer. You say that delphi has a class that does this. Can you point me to the right place in Embarcaderos's DocWiki where this class is described? This way we might start a cleanroom implementation for this.

No, sorry. While searching the web I found some Delphi code snippets showing the use of a class named TDirectory, that's all. I personally do not own or use Delphi (> Version 2).

B.t.w. You know that we have FindAllFiles procedure and a TFileSearcher class in LazFileUtils?

No, I did not. I'll have a deep look.

Thanks,
Marc

Marc Santhoff

Reply by email

Graeme Geldenhuys
to Marc Santhoff: Currently not, to be honest. I could not do much but discuss that topic. To summarize on…
Marc Santhoff wrote
Regarding a TDirectory class I think the properties are the same. The difference is it's a very commen use case to read directories and files into acontainer.

Also take a look inside tiOPF's tiUtils.pas unit. There are lots of gems in there.

https://github.com/graemeg/tiopf/blob/tiopf2/Core/tiUtils.pas#L216

  // Copy all the directories, starting at AStartDir to the StringList
ADirList
  procedure tiDirectoryTreeToStringList(const AStartDir: string; const
ADirList: TStringList; ARecurse: boolean);
  // Copy all the files, from the directory AStartDir, matching the
wildcard AWildCard
  // to the stringList slResult
  procedure tiFilesToStringList(const AStartDir, AWildCard: string;
const AResults : TStringList; const ARecurse : boolean);

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Steve
to Marc Santhoff: No, sorry. While searching the web I found some Delphi code snippets showing the use of a…
Marc Santhoff wrote 34 lines
On Mi, 2015-08-19 at 11:20 +0200, Bart wrote: > On 8/18/15, Marc Santhoff wrote: > >> On Mo, 2015-08-17 at 16:39 +0200, Bart wrote: >>> On 8/17/15, Marc Santhoff wrote: >>> >>>> Plus it's a recurring task (like reading directory entries into a >>>> container - Delphi has a class for, lazarus not). It would have been >>>> nice if there were a template or the like. >>> >>> Care to elaborate on that (in a new thread)? >> > >> Regarding a TDirectory class I think the properties are the same. The >> difference is it's a very commen use case to read directories and files >> into acontainer. > > You say that delphi has a class that does this. > Can you point me to the right place in Embarcaderos's DocWiki where > this class is described? > This way we might start a cleanroom implementation for this. No, sorry. While searching the web I found some Delphi code snippets showing the use of a class named TDirectory, that's all. I personally do not own or use Delphi (> Version 2). > B.t.w. You know that we have FindAllFiles procedure and a > TFileSearcher class in LazFileUtils? No, I did not. I'll have a deep look. Thanks, Marc

the reference you need is
http://docwiki.embarcadero.com/Libraries/XE7/en/System.IOUtils

Reply by email

Anthony Walter
to Bart

I think this might help. I wrote a trivial custom graphic step control. It is in my Cross.Codebot package.

http://codebot.org/snapshops/step-pick.jpg

property Steps: TStrings;
property StepIndex: Integer;
property OnStepClick: TStepEvent;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150820/8e890150/attachment.html>

Reply by email

Luiz Americo Pereira Camara
to Anthony Walter

2015-08-20 19:54 GMT-03:00 Anthony Walter :

Show quoted text 10 lines
I think this might help. I wrote a trivial custom graphic step control. It is in my Cross.Codebot package. http://codebot.org/snapshops/step-pick.jpg property Steps: TStrings; property StepIndex: Integer; property OnStepClick: TStepEvent;

Nice.

Looking for the Cross.Codebot availability

Luiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150821/07f4436d/attachment.html>

Reply by email