Writing on the forum since the use list is down right now.
I have a scrollbar with the style set to "scale". Right now I'm using the scrollbardrag message to store the thumbpos and a mouseUp message to do what I need to do after the user finishes dragging. So far so good.
I want the user to be able to click somewhere on the scrollbar and have the thumbpos set to wherever he clicked The dictionary mentions scrollbardPageInc, scrollbarPageDec, scrollLineInc, and scrollbarLineDec. After experimenting, I found that the scrollbarLinexxx messages are not sent to a scale scrollbar. The scrollbarPagexxx messages are sent but the newposition parameter is always 1 different than the existing thumbpos and does not reflect where the user clicked.
As an example, lets say the scrollbar min and max are set to 1 and 50 and it's currently positioned at thumbpos 25. If the user clicks on it at a position that corresponds to thumbpos 10, the scrollbarPageDec message comes in with a parameter of 24 not 10.
I think this behavior is because the pageincrement property of my scrollbar is set to 1 (by LC not me). It feels like I am going to have to set the thumbpos to a calculated value based on the location of the mouse click, the width of the scrollbar, and startvalue and endvalue of the scrollbar. Before I go down that path, am I missing some obvious way of achieving this?
Pete
Using scrollbars with style "scale"
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Using scrollbars with style "scale"
Hi.
You nailed the procedure. I did this just for fun. In a scrollbar script (I assume horizontal):
Such fun. But it needs to address the width of the thumb.
Craig
You nailed the procedure. I did this just for fun. In a scrollbar script (I assume horizontal):
Code: Select all
on mouseUp
put the endValue of scrollbar 1 into tEnd
put the width of scrollbar 1 into tWidth
put trunc(tEnd/tWidth) into tScale
put item 1 of the clickLoc into tClickH
put the left of scrollbar 1 into leftH
put tclickH - leftH into scaleValue
set the thumbPos of scrollbar 1 to scalevalue * tScale
end mouseUp
Craig
Re: Using scrollbars with style "scale"
What is a "scale" style for scrollbars?
Craig
Craig
Re: Using scrollbars with style "scale"
Thanks Craig, I figured it would have be a homegrown solution.
You probably figured it out but scrollbars with a scale style are displayed as slider controls. On the tools palette, you'll see one next to the progress bar icon.
Pete
You probably figured it out but scrollbars with a scale style are displayed as slider controls. On the tools palette, you'll see one next to the progress bar icon.
Pete
Re: Using scrollbars with style "scale"
Pete.
Of course. Everyone knows that. Now even me.
Craig
Of course. Everyone knows that. Now even me.
Craig