Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Hiding the child control of CExtControlBar in Auto Hide areas Collapse All
Subject Author Date
Jeremy Richards Jul 14, 2008 - 2:50 PM

I am in a situation where I need to hide the child window of a CExtControlBar at times.


Normally this isn’t a problem, just call ShowWindow(SW_HIDE) on the child and it is hidden.  However, if control bar is an auto hide control bar then this doesn’t work -- I can neither hide nor disable the child (or perhaps when I pop open the control bar the child is reshown and reenabled automatically).


Is there anything that can be done about this?

Technical Support Jul 15, 2008 - 10:53 AM

First of all, you should hide CExtControlBar window using the following code:

    CExtControlBar * pBar = . . .
    CFrameWnd * pMainFrame = . . .
    if( pBar->AutoHideModeGet() )
        pBar->AutoHideModeSet( false, false, true, true );
    else
        pMainFrame->ShowControlBar( FALSE, FALSE );


If the CExtControlBar::m_bAppearInDockSiteControlBarPopupMenu property is set to false then control bar’s command will not appear in all built-in menus displayed by Prof-UIS over frame window areas:
    pBar->m_bAppearInDockSiteControlBarPopupMenu = false;

Jeremy Richards Jul 15, 2008 - 11:43 AM

I think you may have misunderstood my problem.


My issue is not with hiding CExtControlBars themselves (they are behaving fine), the problem is when I want to hide the CHILD of the CExtControlBar.


In certain circumstances, I want to hide the child window (a CDialog in this case), while leaving the CExtControlBar itself visible (actually my CExtControlBar derrived class has an OnPaint handler, which draws a default background when the child is hidden).


Now for docked, floating or tabbed control bars the behavior is fine.  However, with autohidden ones, the child is being reshown. (i.e. someone is calling child->ShowWindow(SW_SHOW) or similar and it is not me.

Technical Support Jul 15, 2008 - 1:25 PM

We suppose you have CExtControlBar window and some child window inside it which should be hidden sometimes. Let us suppose this child window is CTreeCtrl window. You should create some CWnd-based container window as child of CExtControlBar window and create CTreeCtrl window as child of container window. The container window should do the following:

  • Move its child window to fit entire container’s client area.
  • Paint it’s cient area with some background and text message over it like There is no data to show in this view.
  • Set focus to visible child window if focus set to container window.
So, the container window should handle WM_SIZE, WM_PAINT and WM_SETFOCUS messages. As result, if the CTreeCtrl window is visible, then user works with it. If the CTreeCtrl window is hidden, then user see empty window with helper message. This UI layout is exactly the same as Document Outline resizable control bar window in Visual Studio .NET / 2005 / 2008. Please note, such container window may also need to route invocations of OnCmdMsg() and PreTranslateMessage() virtual methods into the same virtual methods of its child CTreeCtrl window.

Jeremy Richards Jul 15, 2008 - 2:21 PM

Thank you.  I finally figured this out.  I was hoping to not have to go that route, but I just got it implemented.


It wasn’t obvious though -- it took digging through the auto hide code and realizing that the child window was actually getting its parent reassigned to realize that my initial approach wasn’t going to work.


I have the later approach working now and it does what I need though.