Print Page | Close Window

MarkupListBox

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: MarkupLabel Control
Forum Description: Topics Related to Codejock MarkupLabel Control
URL: http://forum.codejock.com/forum_posts.asp?TID=16535
Printed Date: 23 November 2024 at 11:12pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MarkupListBox
Posted By: jimmy
Subject: MarkupListBox
Date Posted: 29 March 2010 at 6:30am
Hello,

i use the MarkupListBox from MarkupSample.
But is you scroll with mouse wheel it's look like horror.
see markup sample (9 entrys).

Any solution for this ?

  Jimmy



Replies:
Posted By: jimmy
Date Posted: 29 March 2010 at 7:46am
Hello,

found a solution.
Handle WM_MOUSEWHEEL my self.

void CMarkupListBox::OnHandleMouseWheel(WPARAM wParam, LPARAM lParam)
{
    short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);

    // Don't do anything if the vertical scrollbar is not enabled.
    int scrollMin = 0, scrollMax = 0;
    GetScrollRange(SB_VERT, &scrollMin, &scrollMax);
    if ( scrollMin == scrollMax )
        return;

    // Compute the number of scrolling increments requested.
    int numScrollIncrements = abs(zDelta) / WHEEL_DELTA;

    // Each scrolling increment corresponds to a certain number of
    // scroll lines (one scroll line is like a SB_LINEUP or SB_LINEDOWN).
    // We need to query the system parameters for this value.
    int numScrollLinesPerIncrement = 0;
    ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &numScrollLinesPerIncrement, 0);

    // Check if a page scroll was requested.
    if ( numScrollLinesPerIncrement == WHEEL_PAGESCROLL )
    {
        SendMessage(WM_VSCROLL, zDelta > 0 ? SB_PAGEUP : SB_PAGEDOWN, 0);
        return;
    }

    // Compute total number of lines to scroll.
    int numScrollLines = numScrollIncrements * numScrollLinesPerIncrement;

    // Adjust numScrollLines to slow down the scrolling a bit more.
    numScrollLines = max(numScrollLines/3, 1);

    // Do the scrolling.
    for(int i = 0; i < numScrollLines; ++i)
        SendMessage(WM_VSCROLL, zDelta > 0 ? SB_LINEUP : SB_LINEDOWN, 0);
}

  Jimmy




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net