[Lazarus] Embedding a standard dialogue

Antonio Fortuny a.fortuny at sitasoftware.lu
Wed Apr 18 11:15:43 CEST 2012



Le 18/04/2012 09:42, Mark Morgan Lloyd a écrit :
> Apologies for my lousy threading here, a message got chopped by our 
> firewall.
>
> > > Is it possible to embed a standard dialogue in a custom form? For
> > > example, if I wanted to filter text input through a user-specified
> > > regular expression, can I set up a form containing a file-open
> > > dialog plus an edit box for the regex, or do I have to implement
> > > it from scratch?
> >
> > No, you must create your own dialog from scratch.
> >
> > Juha
>
> OK, If I can lead on from this. The cause of bug 21792 that I raised 
> yesterday is, I'm told, that I'd set the main form visible but 
> minimised. The reason I'd done this is that before the form was 
> displayed I wanted the user to provide database login credentials, I 
> couldn't rely on a standard dialogue for that since I also needed to 
> have him select what kind of database- PostgreSQL or Firefox- as well 
> as the server and possibly port.
For such cases I build a DataModule whith auto creation.
In the DataModule OnCreate event code I create and display a modal 
little window asking for credentials. Depending on user's answers I 
cancel the program. Make sure the login form is NOT auto crated.
If credentials are OK, processing continues as usual and the main form 
is created and displayed.
The only thing to take care of is to make sure that the creation of the 
DataModule is done BEFORE the main form in the project code (.dpr or .lpr)
Because the DataModule is never displayed, that's it.

Antonio.
>
> What is the correct thing to do in this sort of situation? I've seen a 
> description of a hack for Delphi which relied on creating the main 
> form manually, should something like that be attempted for Lazarus?
>
> Or should I simply redo the app so that the login is the main form?
>






More information about the Lazarus mailing list