Board index » delphi » Modeless dialog boxes

Modeless dialog boxes

Can someone tell me how to place a modeless dialog box on the screen? I
construct them using Resource Workshop and load modal boxes using
ExecDialog, but can't find anything in the documentation about how to load
a modeless one.

--
Bill Pennal
Bill...@itexas.net
http://www2.itexas.net/~BillPen

 

Re:Modeless dialog boxes


I don't get it. How do I do that?
Bill P.

Peter Vollmann <P.Vollm...@mcd.alcatel.de> wrote in article
<3475301C....@mcd.alcatel.de>...

Quote
> Bill Pennal wrote:

> > Can someone tell me how to place a modeless dialog box on the screen? I
> > construct them using Resource Workshop and load modal boxes using
> > ExecDialog, but can't find anything in the documentation about how to
load
> > a modeless one.

> > --
> > Bill Pennal
> > Bill...@itexas.net
> > http://www2.itexas.net/~BillPen

> To use a not modal dialog, create and insert it just as every other
> window.

> Peter

Re:Modeless dialog boxes


Quote
Bill Pennal wrote:

> I don't get it. How do I do that?
> Bill P.

Hi Bill,

In first when you use it in a procedure or function try this:

procedure WillShowDialog;
var
  YourDlg : PDialog;
begin
  YourDlg := New( PDialog, Init( @Self, 'ResourceName' ) );
  if Applicaton^.MakeWindow( YourDlg ) <> nil then
    YourDlg^.Show( sw_Show );
end;

In the other hand you must use a DlgWindow. This is firstly a Dialog
which
can loading from resource, but it has many property from a window.
Create it in the application consturctor like this examble:

type
  MyApp = object( TApplication );
    .....
    YourDlg : PDlgWindow;

MyApp.Init;
begin
  ....
  YourDlg := New( PDlgWindow, Init( @Self, 'ResourceName' ) );
  ....
end;

Procedure WillShowDlg;
begin
  YourDlg^.Show( sw_Show );
end;

In this way all close buttons in dialog so there is an "OK" or "Cancel"
must change in hide command.

Peter.

Re:Modeless dialog boxes


Quote
Bill Pennal wrote:

> I don't get it. How do I do that?
> Bill P.

You create a windows object as a descendant of TDlgWindow. Then use
Application^.MakeWindow to create the window on screen. (Like for any
other child window created after program startup, except for the use
of TDlgWindow, needed to use a resource template).

You can also override the GetWindowClass and GetClassName methods of
TDlgWindow to change e.g. the cursor or associated icon. See the online
help for more information/details.

Regards,

Remco

--

Remco Vietor                            Department of Chemistry
re...@chem.gla.ac.uk                       J. Black Building
                                        University of Glasgow
                                        Glasgow G12 8QQ
                                        U.K.

Other Threads