Trap CToolBar Show/Hide message 
Author Message
 Trap CToolBar Show/Hide message

Override CToolBar and write your own CalcFixedLayout () which checks whether its
floating (IsFloating()) and do what you want there. Dont forget to call the
CToolbar::CalcFixedLayout () after that..

--
Girish Bharadwaj  [VC++/MVP]
Please don't send email queries.Post them here.
MS Knowledge base articles : http://www.*-*-*.com/

|How can I trap the show/hide message when the user clicks the 'x' button to
|close/hide a floating CControlBar?
|
|Thanks in advance!
|
|
|



Mon, 04 Dec 2000 03:00:00 GMT  
 Trap CToolBar Show/Hide message

Hi Girish,

Hm... None of the followings are called during a "hide" (clicking of the 'x'
of a floating toolbar).  They are called whenever I "show" or move/resize
the toolbar.

CalcFixedLayout ()
CalcDynamicLayout ()
OnSizeParent()

Wendy


Quote:
>Override CToolBar and write your own CalcFixedLayout () which checks
whether its
>floating (IsFloating()) and do what you want there. Dont forget to call the
>CToolbar::CalcFixedLayout () after that..

>--
>Girish Bharadwaj  [VC++/MVP]
>Please don't send email queries.Post them here.
>MS Knowledge base articles : http://support.microsoft.com/support


>|How can I trap the show/hide message when the user clicks the 'x' button
to
>|close/hide a floating CControlBar?
>|
>|Thanks in advance!
>|
>|
>|



Mon, 04 Dec 2000 03:00:00 GMT  
 Trap CToolBar Show/Hide message

I figured out a way to do this.  It might not be the best way.  I would
imagine a better way is to reroute the message map of the CMinidockFrame to
the CControlBar so that the CControlBar will receive a WM_SYSCOMMAND with
the SC_CLOSE wParam.

Anyways, the easy way (it probably works 90% of the time) is to do this is
to use OnWindowPosChanging in your derived ControlBar class.

void CMyControlBar::OnWindowPosChanging( WINDOWPOS* lpwndpos )
{
    // The SWP_HIDEWINDOW is also set when a bar goes from dock to float
    //( ie. even when the user didn't click on the 'x').
    // So, make sure that you check whether the bar is floating or not,
    // the only time that a user can click the 'x' is when the bar is floating.

     if ( IsFloating() &&  
        (lpwndpos->flags & SWP_HIDEWINDOW) ) {

        // Do whatever you have to do
        ...
    }

    // Call the base class
     CControlBar::OnWindowPosChanging( lpwndpos );

Quote:
}

Wendy


Mon, 04 Dec 2000 03:00:00 GMT  
 Trap CToolBar Show/Hide message

While watching VC's build mini bar with SPY++ it shows both WM_CLOSE and
WM_SYSCOMMAND (and many others of course) being received by the window when
I closed it. I would one of these would work for you.

Hope this helps.

--
Pete

Quote:

>Hi Girish,

>Hm... None of the followings are called during a "hide" (clicking of the
'x'
>of a floating toolbar).  They are called whenever I "show" or move/resize
>the toolbar.

>CalcFixedLayout ()
>CalcDynamicLayout ()
>OnSizeParent()

>Wendy



>>Override CToolBar and write your own CalcFixedLayout () which checks
>whether its
>>floating (IsFloating()) and do what you want there. Dont forget to call
the
>>CToolbar::CalcFixedLayout () after that..

>>--
>>Girish Bharadwaj  [VC++/MVP]
>>Please don't send email queries.Post them here.
>>MS Knowledge base articles : http://support.microsoft.com/support


>>|How can I trap the show/hide message when the user clicks the 'x' button
>to
>>|close/hide a floating CControlBar?
>>|
>>|Thanks in advance!
>>|
>>|
>>|



Mon, 04 Dec 2000 03:00:00 GMT  
 Trap CToolBar Show/Hide message

Quote:

>Hi Girish,

>Hm... None of the followings are called during a "hide" (clicking of the
'x'
>of a floating toolbar).  They are called whenever I "show" or move/resize
>the toolbar.

>CalcFixedLayout ()
>CalcDynamicLayout ()
>OnSizeParent()

>Wendy

What about OnShowWindow() ?

cU
--

   http://djuga.home.ml.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retriever 1.1 is out: http://retriever.home.ml.org

Shareware image viewer, thumbnailer & database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Mon, 04 Dec 2000 03:00:00 GMT  
 Trap CToolBar Show/Hide message

Yes, the question is how do I trap those message?!

The parent of a controlbar is CDockBar.  The parent frame of a
controlbar is CMainFrame when it's docked, and it is CMiniDockFrame when
it's floated.  That is, neither the CMainFrame nor a derivative of
CControlBar would
receive any WM_SYSCOMMAND when hiding a minibar when it's floated.

Wendy

Quote:

>While watching VC's build mini bar with SPY++ it shows both WM_CLOSE and
>WM_SYSCOMMAND (and many others of course) being received by the window when
>I closed it. I would one of these would work for you.

>Hope this helps.

>--
>Pete


>>Hi Girish,

>>Hm... None of the followings are called during a "hide" (clicking of the
>'x'
>>of a floating toolbar).  They are called whenever I "show" or move/resize
>>the toolbar.

>>CalcFixedLayout ()
>>CalcDynamicLayout ()
>>OnSizeParent()

>>Wendy



>>>Override CToolBar and write your own CalcFixedLayout () which checks
>>whether its
>>>floating (IsFloating()) and do what you want there. Dont forget to call
>the
>>>CToolbar::CalcFixedLayout () after that..

>>>--
>>>Girish Bharadwaj  [VC++/MVP]
>>>Please don't send email queries.Post them here.
>>>MS Knowledge base articles : http://support.microsoft.com/support




- Show quoted text -

Quote:
>>>|How can I trap the show/hide message when the user clicks the 'x' button
>>to
>>>|close/hide a floating CControlBar?
>>>|
>>>|Thanks in advance!
>>>|
>>>|
>>>|



Mon, 04 Dec 2000 03:00:00 GMT  
 Trap CToolBar Show/Hide message

No.  I've tried pretty much all the WM_ messages.

Quote:


>>Hi Girish,

>>Hm... None of the followings are called during a "hide" (clicking of the
>'x'
>>of a floating toolbar).  They are called whenever I "show" or move/resize
>>the toolbar.

>>CalcFixedLayout ()
>>CalcDynamicLayout ()
>>OnSizeParent()

>>Wendy

>What about OnShowWindow() ?

>cU
>--

>   http://djuga.home.ml.org
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Retriever 1.1 is out: http://retriever.home.ml.org

>Shareware image viewer, thumbnailer & database
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Tue, 05 Dec 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Trap CToolBar Show/Hide message

2. Trap CToolBar Show/Hide message

3. Trap CToolBar Show/Hide message

4. Trap CToolBar Show/Hide message

5. Showing & Hiding a CToolbar

6. Pb: howto intercept show/hide/close event in CToolBar

7. CToolBar: showing/hiding button texts

8. CToolbar: How to show and hide?

9. CToolbar: button names not showing during customization

10. Q: Hiding a button in CToolBar

11. how to map messages from a CToolBar

12. CToolBar - ON_COMMAND messages not getting routed through, why ?

 

 
Powered by phpBB® Forum Software