 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Daryl Guest
|
Posted: Sat Dec 13, 2003 8:33 pm Post subject: Placement of a message dialog |
|
|
Is there any way to place message dialogs exactly where you want them in
relation to your application?
Also, taking it a step further, is it possible to place VCL components
SaveDialog and OpenDialog where you want to in relation to your form?
Thanks
Daryl
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Dec 13, 2003 9:30 pm Post subject: Re: Placement of a message dialog |
|
|
"Daryl" <stockd (AT) tpg (DOT) com.au> wrote
| Quote: | Is there any way to place message dialogs exactly where
you want them in relation to your application?
|
The only thing the VCL has available for that is MessageDlgPos().
| Quote: | is it possible to place VCL components SaveDialog and OpenDialog
where you want to in relation to your form?
|
Not directly, no. You would have to use the dialog's OnShow event to
manually move the parent window via the Win32 API SetWindowPos() function,
ie:
void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
::SetWindowPos(GetParent(OpenDialog1->Handle), NULL, SomeX, SomeY,
0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
Gambit
|
|
| Back to top |
|
 |
Rodolfo Frino Guest
|
Posted: Sun Dec 14, 2003 1:04 pm Post subject: Re: Placement of a message dialog |
|
|
This is one way of doing that
void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
TRect rect;
HWND H = GetParent(dynamic_cast<TOpenDialog*>(Sender)->Handle);
GetWindowRect(H, &rect);
MoveWindow(H,
0,
0,
rect.right - rect.left,
rect.bottom - rect.top,
true);
Abort();
}
Rodolfo
"Daryl" <stockd (AT) tpg (DOT) com.au> wrote
| Quote: | Is there any way to place message dialogs exactly where you want them in
relation to your application?
Also, taking it a step further, is it possible to place VCL components
SaveDialog and OpenDialog where you want to in relation to your form?
Thanks
Daryl
|
|
|
| Back to top |
|
 |
Daryl Guest
|
Posted: Wed Dec 17, 2003 12:55 am Post subject: Re: Placement of a message dialog |
|
|
Thanks Rodolfo...
Just one question:
The use of the API call GetParent - Is the call
GetParent(dynamic_cast<TOpenDialog*>(Sender)->Handle);
actually looking for the parent window of TOpenDialog?
I am a little lost because it looks like the window that is being moved is
the dialog window, the one called from the application's form. Looking at
the properties of TOpenDialog it has an owner but there is no method of
setting its parent. I am creating the TOpenDialog component from the heap
at runtime.
Also, I can see that without Abort() it does not work, but why do you need
it?
Thanks
Daryl
"Rodolfo Frino" <MenInBlack (AT) nowhere (DOT) com> wrote
| Quote: | This is one way of doing that
void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
TRect rect;
HWND H = GetParent(dynamic_cast<TOpenDialog*>(Sender)->Handle);
GetWindowRect(H, &rect);
MoveWindow(H,
0,
0,
rect.right - rect.left,
rect.bottom - rect.top,
true);
Abort();
}
Rodolfo
"Daryl" <stockd (AT) tpg (DOT) com.au> wrote in message
news:3fdb786e (AT) newsgroups (DOT) borland.com...
Is there any way to place message dialogs exactly where you want them in
relation to your application?
Also, taking it a step further, is it possible to place VCL components
SaveDialog and OpenDialog where you want to in relation to your form?
Thanks
Daryl
|
|
|
| Back to top |
|
 |
Rodolfo Frino - Macrosoft Guest
|
Posted: Wed Dec 17, 2003 3:05 am Post subject: Re: Placement of a message dialog |
|
|
"Daryl" <daryl.stock (AT) qr (DOT) com.au> wrote
| Quote: | Thanks Rodolfo...
Just one question:
The use of the API call GetParent - Is the call
GetParent(dynamic_cast<TOpenDialog*>(Sender)->Handle);
actually looking for the parent window of TOpenDialog?
I am a little lost because it looks like the window that is being moved is
the dialog window, the one called from the application's form. Looking at
the properties of TOpenDialog it has an owner but there is no method of
setting its parent. I am creating the TOpenDialog component from the heap
at runtime.
Also, I can see that without Abort() it does not work, but why do you
need
it?
Thanks
Daryl
"Rodolfo Frino" <MenInBlack (AT) nowhere (DOT) com> wrote in message
news:3fdc5fcb (AT) newsgroups (DOT) borland.com...
This is one way of doing that
void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
TRect rect;
HWND H = GetParent(dynamic_cast<TOpenDialog*>(Sender)->Handle);
GetWindowRect(H, &rect);
MoveWindow(H,
0,
0,
rect.right - rect.left,
rect.bottom - rect.top,
true);
Abort();
}
Rodolfo
"Daryl" <stockd (AT) tpg (DOT) com.au> wrote in message
news:3fdb786e (AT) newsgroups (DOT) borland.com...
Is there any way to place message dialogs exactly where you want them
in
relation to your application?
Also, taking it a step further, is it possible to place VCL components
SaveDialog and OpenDialog where you want to in relation to your form?
Thanks
Daryl
|
|
|
| Back to top |
|
 |
Rodolfo Frino - Macrosoft Guest
|
Posted: Wed Dec 17, 2003 4:04 am Post subject: Re: Placement of a message dialog |
|
|
1) From MS:
"The parent window provides the coordinate system used for positioning a
child window."
2) The Abort procedure cancels the WM_NOTIFY message that
Windows sends to its common dialogs. This allows you to
change the position of OpenDialog.
Rodolfo
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|