Page 1 of 1
Spinbutton (little arrows) - reversed events?
Posted: Mon Apr 22, 2013 5:52 am
by rumplestiltskin
I'm more than a little confused about the spinbutton (the little arrows scrollbar).
It appears to me the events are reversed. Consider this:
Code: Select all
on scrollbarLineInc
subtract 1 from field 1 -- SUBTRACT WHEN YOU INCREMENT
end scrollbarLineInc
on scrollbarLineDec
add 1 to field 1 -- ADD WHEN YOU DECREMENT
end scrollbarLineDec
Why is it done this way? When you click the UP arrow, it sends a "decrement" message yet you have to ADD.
...unless I am misunderstanding the mean of "Inc" and "Dec".
This looks like a bug to me.

Re: Spinbutton (little arrows) - reversed events?
Posted: Mon Apr 22, 2013 6:01 am
by snm
Yes, you are missunderstanding increment and decrement. Increment means you must add.
Marek
Re: Spinbutton (little arrows) - reversed events?
Posted: Mon Apr 22, 2013 6:09 am
by Simon
Not really understanding your question.
Your code is set up to be reverse.
Simon
Re: Spinbutton (little arrows) - reversed events?
Posted: Mon Apr 22, 2013 6:30 am
by rumplestiltskin
I've attached Simon's stack but modified so that the scrollbar has been reduced in height so it is a set of "little arrows".
Now examine the script of that scrollbar object and you'll see when you click on the up arrow, the number increments (which is the correct behavior)
but the script that does this is the "Dec" rather than the "Inc".
So it is the "Decrement" script that increments the number and the "Increment" script that decrements it.
That is my complaint.
EDIT: ...time passes...
From the Dictionary entry for scrollbarLineDec:
Handle the scrollbarLineDec message if you want to respond to the use of the top or left scrollbar arrow.
So it seemed to me (erroneously, now that I can see all the possibilities) the concept was partially reversed from the beginning. I would have thought the "Dec" message would be generated from the
bottom or left scrollbar arrow. But then I realized the bottom arrow would
increase the scroll of a field so the "Inc" message would, indeed, be the proper one. Maybe I am wishing the simple set of "double-arrows" (the little arrows type of scrollbar) wouldn't -be- a scrollbar at all and should be its own type of object that would reflect the behavior of the real world (like an elevator). I also think it may be time for me to get some sleep.
Thanks, all, for your patience.
Barry
Re: Spinbutton (little arrows) - reversed events?
Posted: Mon Apr 22, 2013 6:51 am
by Simon
From the dictionary:
Parameters:
The newPosition is the new position of the scrollbar thumb.
How do you see this in a horizontal scrollbar? Increments to the right.
Ok I get it, you want it to flip +90 degrees instead of -90 (or is it the other way around?).
Too easy to adapt to.
Simon
Re: Spinbutton (little arrows) - reversed events?
Posted: Mon Apr 22, 2013 6:58 am
by rumplestiltskin
Simon,
Yeah, you anticipated what my confusion was. Now that I can accept that the little arrows are a form of scrollbar, it all comes together and I understand the logic. I'll still comment my scripts heavily. I tend to anthropomorphize my stacks and speak to them through my comments so returning to them months later displays -my- logic for doing things the way I did.
Thanks,
Barry