Spinbutton (little arrows) - reversed events?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Spinbutton (little arrows) - reversed events?

Post by rumplestiltskin » Mon Apr 22, 2013 5:52 am

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. :oops: :?:

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: Spinbutton (little arrows) - reversed events?

Post by snm » Mon Apr 22, 2013 6:01 am

Yes, you are missunderstanding increment and decrement. Increment means you must add.

Marek

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Spinbutton (little arrows) - reversed events?

Post by Simon » Mon Apr 22, 2013 6:09 am

Not really understanding your question.
Untitled 1.zip
LC 6
(576 Bytes) Downloaded 275 times
Your code is set up to be reverse.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Spinbutton (little arrows) - reversed events?

Post by rumplestiltskin » Mon Apr 22, 2013 6:30 am

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. :oops:

Thanks, all, for your patience.

Barry
Attachments
Untitled 1.livecode.zip
(1 KiB) Downloaded 246 times
Last edited by rumplestiltskin on Mon Apr 22, 2013 6:53 am, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Spinbutton (little arrows) - reversed events?

Post by Simon » Mon Apr 22, 2013 6:51 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Spinbutton (little arrows) - reversed events?

Post by rumplestiltskin » Mon Apr 22, 2013 6:58 am

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

Post Reply