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 » CExtGridWnd scroll-bar Collapse All
Subject Author Date
Offer Har Apr 16, 2007 - 2:07 PM

Dear Support,

When pressing the buttons of the scroll-bars, it moves pixel-by-pixel, which is very slow.
How can I make the scroll-bar scroll at a normal speed?

Regards,
Ron.

Technical Support Apr 17, 2007 - 1:59 AM

You should handle the SB_LINE*** scroll bar events in the same way as it is implemented in the CExtScrollWnd::OnHScroll() and CExtScrollWnd::OnVScroll() methods. As you can see, these methods invoke CExtScrollWnd::OnSwDoScroll() where the SB_LINE*** scroll bar events are handled and scrolling position adjustment is computed.

Suhai Gyorgy Apr 17, 2007 - 1:24 AM

SiwModifyStyle(__ESIS_STV_ITEM|__ESIS_STH_ITEM, __ESIS_ST_MASK);
This makes the grid scroll both horizontally and vertically item-by-item.

Offer Har Apr 17, 2007 - 12:58 PM

Suhai & Support,

The suggested solution of Suhai surfaced a bug in the grid (I will send you some captures via mail)
Regarding the support suggestion - It is not clear to me what you suggest - can you please give me some more details, and explain how it solves the problem?

Thanks,
Ron.

Technical Support Apr 18, 2007 - 11:38 AM


The scroll bar common control allows you to specify scrolling range, scrolling position and scrolling page size. It does not allow you to specify the scrolling line size. If you want to increment/decrement the scrolling position on some value not equal to 1 when the up/down/left/right scroll bar button is pressed, then you should handle the button click event and change the scrolling position of the scroll bar common control manually.

You should handle the WM_HSCROLL and WM_VSCROLL messages exactly like the CExtScrollWnd class does:

void CExtScrollWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
      if(         pScrollBar != NULL
            &&    pScrollBar->SendChildNotifyLastMsg()
            )
            return;
      if( pScrollBar != GetScrollBarCtrl(SB_HORZ) )
            return;
      OnSwDoScroll( MAKEWORD( nSBCode, -1 ), nPos );
}

void CExtScrollWnd::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
      if(         pScrollBar != NULL
            &&    pScrollBar->SendChildNotifyLastMsg()
            )
            return;
      if( pScrollBar != GetScrollBarCtrl(SB_VERT) )
            return;
      OnSwDoScroll( MAKEWORD( -1, nSBCode ), nPos );
}
Then you should implement the OnSwDoScroll() method using the CExtScrollWnd::OnSwDoScroll() method as sample. You can see how the CExtScrollWnd::OnSwDoScroll() method handles the clicks on each part of the scroll bar common control.

In fact, you can simply use the CExtScrollWnd class as the base and very convenient class for implementing your own scrollable windows. You will simply need to implement the following virtual methods of the CExtScrollWnd class and the scrollable control will be ready to use:
      virtual CSize OnSwGetTotalSize() const;
      virtual CSize OnSwGetPageSize( int nDirection ) const;
      virtual CSize OnSwGetLineSize( int nDirection ) const;
      virtual void OnSwPaint( CDC & dc );


If you are using the MFC’s CScrollView class and document/view architecture in your project, then you can replace the CScrollView window with the CView window and a child CExtScrollWnd -based window in it.

Offer Har Apr 18, 2007 - 1:20 PM

Dear Support,

It is not clear to me what to do...
I have a gird, and i want the scroll bars to move in each press more then one pixel as it moves now.
One pixel in the grid is very small amount to move with each press. Even if you kill the button pressed, the grid scroll very slow.

Please explain how to apply your comments a grid object.

Thanks,
Ron.

Technical Support Apr 19, 2007 - 6:47 AM

You can play with the CExtScrollItemWnd::OnSwGetLineSize() virtual method which returns the size of a horizontal/vertical scrolling line which is used to scroll the window by lines.

Offer Har Apr 19, 2007 - 8:01 AM

But how do i get this CExtScrollItemWnd? I am in CExtGridWnd.

Technical Support Apr 19, 2007 - 12:16 PM

You can read about this in Prof-UIS Grid Brief Overview (the grid control’s inheritance between the first and second paragraphs).