Using scrollbars with style "scale"
Posted: Tue Oct 21, 2014 8:20 pm
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
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