 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Stefano Bonifazi Guest
|
Posted: Fri Oct 14, 2005 6:51 pm Post subject: stop undocked controls from closing |
|
|
Hi all
Is there a way to prevent a floating undocked control from being closed by
pushing the "x" on its windows's upper right corner?
Thank You very much in advance,
Stefano B.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Oct 14, 2005 8:44 pm Post subject: Re: stop undocked controls from closing |
|
|
"Stefano Bonifazi" <stefboombastic (AT) libero (DOT) it> wrote
| Quote: | Is there a way to prevent a floating undocked control from being
closed by pushing the "x" on its windows's upper right corner?
|
If you are using a TForm, then set the CanClose parameter to False in the
OnCloseQuery event, or the Action parameter to caNone in the OnClose event.
If you are creating your own HWND via CreateWindow/Ex(), then your window
procedure will have to intercept the WM_SYSCOMMAND message. The message's
wParam value will contain the SC_CLOSE flag when the window is being closed.
Discard the message without passing it to DefWindowProc() to prevent the
closure.
Gambit
|
|
| Back to top |
|
 |
Stefano Bonifazi Guest
|
Posted: Fri Oct 14, 2005 9:24 pm Post subject: Re: stop undocked controls from closing |
|
|
Thank You Mr Gambit,
Well the problem was that when undocking the controls they created their
floating window by themselves so I had no way to manage their OnClose event
at all
But I found that I can set the class of the window they use as floating
window when undocked by the "FloatingDockSiteClass" property.
So now I implemented a descendant of TCustomDockForm to use with them, that
does not show the "biSystemMenu" at all
Best Regards,
Stefano B.
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> ha scritto nel messaggio
news:43501a5f (AT) newsgroups (DOT) borland.com...
| Quote: |
"Stefano Bonifazi" <stefboombastic (AT) libero (DOT) it> wrote in message
news:434ffd95$1 (AT) newsgroups (DOT) borland.com...
Is there a way to prevent a floating undocked control from being
closed by pushing the "x" on its windows's upper right corner?
If you are using a TForm, then set the CanClose parameter to False in the
OnCloseQuery event, or the Action parameter to caNone in the OnClose
event.
If you are creating your own HWND via CreateWindow/Ex(), then your window
procedure will have to intercept the WM_SYSCOMMAND message. The message's
wParam value will contain the SC_CLOSE flag when the window is being
closed.
Discard the message without passing it to DefWindowProc() to prevent the
closure.
Gambit
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Oct 15, 2005 12:13 am Post subject: Re: stop undocked controls from closing |
|
|
"Stefano Bonifazi" <stefboombastic (AT) libero (DOT) it> wrote
| Quote: | Well the problem was that when undocking the controls they
created their floating window by themselves so I had no way
to manage their OnClose event at all
|
Sorry, I misread what you said before.
| Quote: | But I found that I can set the class of the window they use as floating
window when undocked by the "FloatingDockSiteClass" property.
|
I have never seen that property before. I'll have to look at that, it might
help me with some issues in my own projects ;-)
| Quote: | So now I implemented a descendant of TCustomDockForm to
use with them, that does not show the "biSystemMenu" at all
|
That will not prevent a window from being closed at all. A user can still
use ALT-F4 to close an active window even when it does not have a X button
or a system menu. Since you are deriving a new class, you can override the
CloseQuery() method, or override the WndProc() method to intercept the
WM_SYSCOMMAND or WM_CLOSE message.
Gambit
|
|
| Back to top |
|
 |
Stefano Bonifazi Guest
|
Posted: Sun Oct 16, 2005 6:00 pm Post subject: Re: stop undocked controls from closing |
|
|
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote
| Quote: |
"Stefano Bonifazi" <stefboombastic (AT) libero (DOT) it> wrote in message
news:43502184 (AT) newsgroups (DOT) borland.com...
But I found that I can set the class of the window they use as floating
window when undocked by the "FloatingDockSiteClass" property.
I have never seen that property before. I'll have to look at that, it
might
help me with some issues in my own projects
|
Yes maybe it's a new property of BCB6 ... I don't remember it with BCB5 ...
And I found other nice properties connected to Docking stuff that I never
heard about before ... maybe they renewed "Docking" !?!
| Quote: |
So now I implemented a descendant of TCustomDockForm to
use with them, that does not show the "biSystemMenu" at all :-)
That will not prevent a window from being closed at all. A user can still
use ALT-F4 to close an active window even when it does not have a X button
or a system menu. Since you are deriving a new class, you can override
the
CloseQuery() method, or override the WndProc() method to intercept the
WM_SYSCOMMAND or WM_CLOSE message.
|
Yes and I've already overridden CloseQuery ... but then I found that
TCustomDockForm::Close acts "like" setting Visible=false of the undocked
control ... and in my application it's more usefull letting the user to
"hide" the floating window by pushing the "x" and then make it again visible
programmately whenever needed :-)
| Quote: |
Gambit
Who other so great ? ... Thank You very much Mr. Gambit |
Stefano B.
|
|
| 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
|
|