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 » CExtScrollWnd and CExtToolControlBar Collapse All
Subject Author Date
Rafkat Medvedev Sep 17, 2005 - 8:43 AM

 

Good time of the day!


There is window CChildView (inherited from CExtScrollWnd). In it are added 3 CExtToolControlBar and 1 CSliderCtrl (as in example AdoRecordsetView):


class CChildView : public CExtScrollWnd
{
............


public:
 CExtToolControlBar m_wndToolbarHL, m_wndToolbarHR, m_wndToolbarV;
 CSliderCtrl m_wndSliderV;
 CExtScrollBar m_wndScrollBarH, m_wndScrollBarV;


............


}


int CChildView ::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CExtScrollWnd::OnCreate(lpCreateStruct) == -1)
  return -1;


 m_wndScrollBarH.m_eSO = CExtScrollBar::__ESO_BOTTOM;
 m_wndScrollBarV.m_eSO = CExtScrollBar::__ESO_RIGHT;
 if( ! m_wndScrollBarV.Create(
   WS_CHILD|WS_VISIBLE|SBS_VERT|SBS_RIGHTALIGN,
   CRect(0,0,0,0),
   this,
   1
   )
  )
 {
  ASSERT( FALSE );
  return -1;
 }
 if( ! m_wndScrollBarH.Create(
   WS_CHILD|WS_VISIBLE|SBS_HORZ|SBS_BOTTOMALIGN,
   CRect(0,0,0,0),
   this,
   2
   )
  )
 {
  ASSERT( FALSE );
  return -1;
 }


 m_wndScrollBarH.SyncReservedSpace( &m_wndScrollBarV );
 m_wndScrollBarV.SyncReservedSpace( &m_wndScrollBarH );
 
 if( ! m_wndSliderV.Create(
   WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS
    |TBS_VERT|TBS_BOTH|TBS_NOTICKS,
   CRect(0,0,1,60),
   this,
   3
   )
  )
 {
  ASSERT( FALSE );
  return -1;
 }
 m_wndScrollBarV.m_hWndAfter = m_wndSliderV.GetSafeHwnd();
 m_wndSliderV.SetRange( 1, 100 );
 m_wndSliderV.SetPos( 1 );
 m_wndSliderV.SetLineSize( 1 );
 m_wndSliderV.SetPageSize( 0 );


 if(  (! m_wndToolbarHL.Create(
    NULL,
    this,
    4,
    WS_CHILD|WS_VISIBLE
     |CBRS_ALIGN_BOTTOM|CBRS_TOOLTIPS
     |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
    ) )
  || (! m_wndToolbarHL.LoadToolBar(IDR_TOOLBAR_SMALL_ICONS_HORZ_LEFT) )
  )
 {
  ASSERT( FALSE );
  return -1;
 }
 m_wndToolbarHL.MoveWindow( 0, 0, 42, 1 );
 m_wndScrollBarH.m_hWndBefore = m_wndToolbarHL.GetSafeHwnd();


 if(  (! m_wndToolbarHR.Create(
    NULL,
    this,
    5,
    WS_CHILD|WS_VISIBLE
     |CBRS_ALIGN_BOTTOM|CBRS_TOOLTIPS
     |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
    ) )
  || (! m_wndToolbarHR.LoadToolBar(IDR_TOOLBAR_SMALL_ICONS_HORZ_RIGHT) )
  )
 {
  ASSERT( FALSE );
  return -1;
 }
 m_wndToolbarHR.MoveWindow( 0, 0, 56, 1 );
 m_wndScrollBarH.m_hWndAfter = m_wndToolbarHR.GetSafeHwnd();


 if(  (! m_wndToolbarV.Create(
    NULL,
    this,
    6,
    WS_CHILD|WS_VISIBLE
     |CBRS_ALIGN_RIGHT|CBRS_TOOLTIPS
     |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
    ) )
  || (! m_wndToolbarV.LoadToolBar(IDR_TOOLBAR_SMALL_ICONS_VERT_TOP) )
  )
 {
  ASSERT( FALSE );
  return -1;
 }
 m_wndToolbarV.MoveWindow( 0, 0, 1, 56 );
 m_wndScrollBarV.m_hWndBefore = m_wndToolbarV.GetSafeHwnd();


 if(  (! m_wndToolbarV1.Create( // <-- This checking necessary to insert after/before m_wndToolbarV or m_wndSliderV
    NULL,
    this,
    7,
    WS_CHILD|WS_VISIBLE
     |CBRS_ALIGN_RIGHT|CBRS_TOOLTIPS
     |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
    ) )
  || (! m_wndToolbarV1.LoadToolBar(IDR_TOOLBAR_SMALL_ICONS_MAP_VERT_BOTTOM) )
  )
 {
  ASSERT( FALSE );
  return -1;
 }


 m_wndToolbarV1.MoveWindow( 0, 0, 1, 16 );
 m_wndScrollBarV.m_hWndAfter = m_wndToolbarV1.GetSafeHwnd(); //////// ???????????????????
.......


}


There is two small questions:


1. As possible add one more (CExtToolControlBar) after/before m_wndToolbarV or other CExtToolControlBar in one row or line? (after all after using m_wndScrollBarV.m_hWndAfter = m_wndToolbarV.GetSafeHwnd(); this do is not got)


2. When change the size CChildView position CExtToolControlBar and CSliderCtrl remains former (that is to say checking are found in the middle screen). How I change the position a checking when change the size parental window?


Thank you in advance for answer.

Technical Support Sep 20, 2005 - 8:56 AM

Please copy the CInplaceToolbarWnd class from the AdoRecordsetView sample to your project and use it instead the CExtToolControlBar class. I.e. the m_wndToolbarHL, m_wndToolbarHR and m_wndToolbarV properties of your CChildView class should be of the CInplaceToolbarWnd class. The CExtScrollBar window supports only one "before" and only one "after" HWND handle of the windows which stick before/after the scroll bar. So, if you want to see more than one window before or after the scroll bar, than you should create a container window for your two toolbar windows and then specify container’s HWND handle as the CExtScrollBar::m_hWndBefore or CExtScrollBar::m_hWndAfter property value. The container window can be a very simple CWnd based control which simply aligns all the children inside it into horizontal or vertical chain.