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 General Discussion » CExtControlBar focus Collapse All
Subject Author Date
Ladislav Prosek Mar 3, 2004 - 9:55 AM

Hi,


how do I tell when a CExtControlBar gets focus? WM_SETFOCUS messages are not sent to the window...


Thanx


LP

Bon Jovi Apr 19, 2022 - 5:51 AM

Thank you very much for your post; it helped me a lot. I also hope you will continue to share your knowledge with me and everyone, thank you very much, dear. https://iogamesio.onl https://wordlewebsite.com

Jos Smit Sep 1, 2008 - 7:01 AM

I tried overriding m_CExtControlBar::OnUpdateCmdUI(), I tried using m_bWindowActive, and I tried using IsBarWindowActive(). They all give pretty much the same results, they return the wrong information. It seems like they return true only when the control bar is visible (I use tabbing intensively) and the focus in on another control bar (in another tab group).


What I really want is a function that returns true if the tab is visible. Using active was already a second choice, but that doesn’t seem to work.


Can anyone help me with either a function that returns true when visible, or a way to make this activation mechanism work.

Technical Support Sep 1, 2008 - 10:51 AM

First of all, you can get a pointer to the tabbed bar container if your bar is inside a tabbed group:

CExtControlBar * pYourBar = . . .
CExtDynTabControlBar * pTabBar = pYourBar->_GetNearestTabbedContainer();
      if( pTabBar == NULL )
            return . . . // The pTabBar is not in tabbed group.
LONG nCurSel = pTabBar->GetSwitcherSelection();
      if( nCurSel < 0L )
            return . . . // There is no bar selected in tabbed group. This is possible only during drag-n-drop.
CExtControlBar * pSelectedBar = pTabBar->GetBarAt( nCurSel, true );
      if( LPVOID(pSelectedBar) != LPVOID(pYourBar) )
            return . . . // The pYourBar is not selected bar in tabbed group.
// If we are here, then the pYourBar bar is selected bar inside its tabbed group.


Technical Support Mar 4, 2004 - 9:31 AM

Dear Ladislav,

The WM_SETFOCUS message is sent to the resizable bar window when you click on its caption bar. You can make sure of this by using the Spy++ program. But the user may also activate the resizable bar by clicking on its child window. In this case, the WM_SETFOCUS message is not sent.

To detect whether the active state is changed, the
CExtControlBar class uses an m_bWindowActive internal flag. Please take a look at the CExtControlBar::OnUpdateCmdUI() method in the ExtControlBar.cpp file. You may override this method and use it in the same way.