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 » Custom ScrollBar of GridWnd Collapse All
Subject Author Date
Bahrudin Hrnjica Feb 28, 2006 - 6:58 AM

I implemented Dialog which contains ExtGridWnd like custom control with custom horizontal Scrollbars. I created scrollbar in PreSubclassWnd, and reposition in CCustomExtGridWnd::OnSize. Code look like

void CCustomExtGridCtrl::OnSize(UINT nType, int cx, int cy)
{
    CExtGridWnd::OnSize(nType, cx, cy);
    m_nBottomToolbarWidth=cx/2;
    int nOffsetV=::GetSystemMetrics(SM_CYHSCROLL);
    m_wndScrollBarH.MoveWindow(m_nBottomToolbarWidth,cy-nOffsetV,cx-m_nBottomToolbarWidth,nOffsetV);
}

When I try to resize dialog, old scroll bar apears as well as custom scrolls.Whats wrond with this code.

Technical Support Feb 28, 2006 - 10:40 AM

You need to override the CWnd::GetScrollBarCtrl() virtual method and return your scroll bar. This virtual method is used to detect whether the built-in scroll bar like non-client areas is needed. We recommend you use the CExtScrollBar window which automatically docks with the border of the grid window and aligns other controls in the same row/column with it. The AdoRecordsetView sample application demonstrates how to use CExtScrollBar inside a CExtGridWnd-derived class.

Bahrudin Hrnjica Mar 1, 2006 - 11:29 PM

Offcourse,I override GetScrollBarCtrl but instead of OnSize message i found that reposition scrolbar must be done in OnSwRecalcLayout override virtual method. And now it works fine.
Anyway thank You.