BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

stop undocked controls from closing

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Stefano Bonifazi
Guest





PostPosted: Fri Oct 14, 2005 6:51 pm    Post subject: stop undocked controls from closing Reply with quote



Hi all Smile
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





PostPosted: Fri Oct 14, 2005 8:44 pm    Post subject: Re: stop undocked controls from closing Reply with quote




"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





PostPosted: Fri Oct 14, 2005 9:24 pm    Post subject: Re: stop undocked controls from closing Reply with quote



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 Sad
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 Smile
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





PostPosted: Sat Oct 15, 2005 12:13 am    Post subject: Re: stop undocked controls from closing Reply with quote


"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 Sad

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 Smile

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





PostPosted: Sun Oct 16, 2005 6:00 pm    Post subject: Re: stop undocked controls from closing Reply with quote


"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 Wink

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 ? Smile ... Thank You very much Mr. Gambit

Stefano B.



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.