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 » CExtZoomScrollBar in a Main Frame's Status Bar Collapse All
Subject Author Date
Martin Ashton Aug 9, 2009 - 9:35 PM

Hi,


I have embedded a CExtZoomScrollBar in a CMainFrame’s status bar. The CMainFrame is derived from CExtNCW<CFrameWnd> and it’s status bar from CExtStatusControlBar. The result looks great and is just what I want but I am not getting any ON_WM_HSCROLL messages via the CMainFrame’s message map.


I derived the code from your ZoomScrollBar example. I noticed that in the example you embed the CExtZoomScollBar in a ChildView’s status bar. 


I replaced


CMainFrame * pMainFrame = _GetMainFrame();


with


CMainFrame * pMainFrame = this;


Could this be the cause of the problem?


Your help with this is much appreciated.


Rgds,


Martin Ashton

Technical Support Aug 10, 2009 - 6:21 AM

The zoom scroll bar control is based on the standard scroll bar common control. All the command controls always send notification messages to their parent window. So, your CExtZoomScrollBar zoom scroll bar sends the WM_HSCROLL messages to its parent CExtStatusControlBar status bar window. The ZoomScrollBar sample application has the CMainFrame::CMyStatusBar status bar class which is defined locally in the scope of the CMainFrame class:

 class CMyStatusBar : public CExtStatusControlBar
      {
      protected:
            virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
            {
                  if( message == WM_HSCROLL || message == WM_VSCROLL )
                        return GetParent()->GetDlgItem(AFX_IDW_PANE_FIRST)->SendMessage( message, wParam, lParam );
                  return CExtStatusControlBar::WindowProc( message, wParam, lParam );
            }
      }; // class CMyStatusBar

As you can see, the WindowProc() virtual method simply redirects the scrolling messages to the child window of the main frame. This child window has the AFX_IDW_PANE_FIRST standard dialog control identifier. This child window is the view window in SDI frame based applications. The CFrameWnd class automatically detects its child window with the AFX_IDW_PANE_FIRST dialog control identifier and resizes it to cover entire center area of the frame which is free of any control bars placed near the frame borders. The view window inside the SDI frame window always have the AFX_IDW_PANE_FIRST dialog control identifier. You can redirect the scrolling messages to main frame window instead of view:
 class CMyStatusBar : public CExtStatusControlBar
      {
      protected:
            virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
            {
                  if( message == WM_HSCROLL || message == WM_VSCROLL )
                        return GetParentFrame()->SendMessage( message, wParam, lParam );
                  return CExtStatusControlBar::WindowProc( message, wParam, lParam );
            }
      }; // class CMyStatusBar