Discussion:
Live Scrolling Using LScrollBar
(too old to reply)
Neel
2006-04-06 14:02:41 UTC
Permalink
Hi,
I am trying to implement Live Scrolling using LScrollBar in
CAppearanceApp. I have a Pane LScrollBar inside LView. I draw a graph
inside a Pane, and wanted to scroll that graph using LScrollBar. I did
set Kind = Live Scrolling in Constructor. But could not trap the event
when user scroll the thumb using small side arrows constantly without
moving anywhere of LScrollBar. I did get event when user click on
aynwhere in scrollbar but could not scroll the graph when user
constantly push the arrow keys...( i.e. Live Scrolling). Please have a
look at snippet of code and suggest what should i do to implement live
scrolling.

/*******************************************************************************/
case msg_ScrollAction:
{
LScrollBar::SScrollMessage *l_pSScrollMessage =
static_cast<LScrollBar::SScrollMessage*>(f_pParam);

int l_nMin = l_pSScrollMessage->scrollBar->GetMinValue();
int l_nMax = l_pSScrollMessage->scrollBar->GetMaxValue();
int l_nVal = l_pSScrollMessage->value;
int l_nImd;
switch(l_pSScrollMessage->hotSpot)
{
case kControlUpButtonPart:
l_nVal--;
break;
case kControlDownButtonPart:
l_nVal++;
break;
case kControlPageUpPart:
l_nImd = l_nMax / 20;
if(l_nImd <= 0) l_nImd = 1;
l_nVal -= l_nImd;
break;
case kControlPageDownPart:
l_nImd = l_nMax / 20;
if(l_nImd <= 0) l_nImd = 1;
l_nVal += l_nImd;
break;
case kControlIndicatorPart:
{
m_bRedrawGraph = true;
m_nRedrawGraphValue = l_nVal;
}
break;
}
if(l_nVal < l_nMin) l_nVal = l_nMin;
if(l_nVal > l_nMax) l_nVal = l_nMax;
if(l_nVal != l_pSScrollMessage->value)
{
l_pSScrollMessage->scrollBar->SetValue(l_nVal);
RefreshGraph(l_nVal);
}
break;
}
case msg_ThumbDragged:
case msg_ControlClicked:
case SR_GRAPH_SCROLL:
RefreshGraph();
break;

/**************************************************************************************************/
Thanks in advance.

Neel.
David Phillip Oster
2006-04-07 02:09:23 UTC
Permalink
Post by Neel
I am trying to implement Live Scrolling using LScrollBar in
CAppearanceApp.
You are way off. Please the reread Chapter 7, on Views, in
PowerPlant_Book.pdf. Pay particular attention to the section on using
LScroller. Then read LScrollerView.cp. Note that the Constructor
Property Inspector for an instance of LScrollerView has a "Live
Scrolling" checkbox.

Loading...