Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShowMessage

Status
Not open for further replies.

heecm

Programmer
Dec 3, 2003
10
JP
Hi,

I have a main form which will open many other forms with their own handles in Windows TaskBar using the following code:

procedure TCdsEnvEdtFrm.CreateParams(var Params:TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
Params.WndParent := GetDesktopWindow;
end;

But a ShowMessage dialog from these forms will pop-up on top of the main form instead on the respective form. When I click the OK button on the ShowMessage dialog, it then goes back to the respective form.

What happening here. Any solution for this?

Thanks.

regards,
CM
 
As far as I know showmessage always appears screen centre.
there is a version of messagedlg, messagedlgpos that you can position as required, unfortunatly the position is relative to the screen not the form, but you could obtain the correct co-ords.


Steve:
A Delphi Programmer
 
Hi Steve,

Maybe I am not clear in my question. What happen now in my app is I have a MAIN form open a CUST form. This CUST form has the override CreateParams so that it has its own handle in the Windows TaskBar.

Now this CUST form is maximized and show in my entire desktop screen. Now let say there is a button in this CUST form and this button only has ShowMessage function.

Once I click on this button, the ShowMessage dialog pop-up on top of MAIN form (desktop backgroup switch to MAIN form from CUST form).

When I click on the OK button on ShowMessage dialog, desktop switch back to CUST form.

I think I am clear this time.

Thanks.

regards,
CM
 
I think ShowMessage and MessageDlg are using MAIN form as parent.

Is there any quick solution out of it apart from writing my own message dialog form?

CM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top