Page 1 of 1

Using Little Arrows

Posted: Sun Mar 08, 2015 7:44 pm
by Ultravibe
Hi there!
I want to use Little arrows to adjust timer parameters (minutes,seconds)
which handlers is tell me about: "up" arrow is pressed, "down" arrow is pressed
i mean how it is spelling: "on UpArrow" or smthg like that...
i need to use it in Little arrows script

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 7:56 pm
by sefrojones
Do you mean the arrow keys? If so, check out the "arrowkey" message in the dictionary.

Code: Select all

on arrowkey pKey
   switch pKey
      case "up"
         --do up stuff
         
         break
      case "down"
         --do down stuff
           
         break
      case "left"
         --do left stuff
          
         break
      case "right"
         --do right stuff
            
         break
   end switch
end arrowkey
--Sefro

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 8:12 pm
by Ultravibe
Sefro, no!
I use element like on photo.
Which messages is sent to element when arrow "Up" or "Down" is pressed? I mean arrows of control element

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 8:44 pm
by SparkOut
Aha, this is actually a scrollbar, with the type set to littlearrows. So you can use the scrollbarDrag message:

Code: Select all

on scrollbarDrag tThumbPos
   put tThumbPos into field 1
end scrollbarDrag
You can set the startValue and endValue to restrict the range, and the lineInc to choose by how much the value will change on each press of the little arrow.
Note that you can't set a negative value for startValue or endValue in the property inspector, but you can by script.

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 9:01 pm
by Ultravibe
And what if i just need to know which little arrow is pressed? (Without adding or subtracting thumbPos and using it!)
Just detect which arrow...

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 9:16 pm
by dunbarx
Hi.

I do not think that there is a native way to determine which of the "little arrows" is pressed. (I did not know, like Sparkout, what this actually was, until I allowed the cursor to hover over the scrollbar icon in the toolbar).

Anyway, I would set a custom property of the scrollbar with the scrollBarDrag message, and test to see if the new thumbPos is above or below that value. I think you already had this concept in mind.

Craig Newman

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 10:23 pm
by Ultravibe
Yes,Craig, thank you!

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 10:32 pm
by Simon
How about this;

Code: Select all

on mouseUp
   if the thumbPosition of me > 500 then
      put "up"
   else
      put "down"
   end if
   set the thumbPosition of me to 500
end mouseUp

Simon

Re: Using Little Arrows

Posted: Sun Mar 08, 2015 10:44 pm
by jmburnod
This should work:

Code: Select all

on scrollbarDrag tThumbPos
   if tThumbPos > fld 1 then
      put "up"
   else
      put "down"
   end if
   put tThumbPos into field 1
end scrollbarDrag
Best regards
Jean-Marc

Re: Using Little Arrows

Posted: Mon Mar 09, 2015 12:10 am
by Ultravibe
Jean-Marc, thank you!
I do the same algorhythm and it works!
But it's much better the way that Simon advised)))))

Re: Using Little Arrows

Posted: Mon Mar 09, 2015 12:24 am
by Klaus
Hi guys,

use "on scrollbarLineDec" and "on scrollbarLineInc" together with an appropiate value
for "lineInc" in the inspector for the "little arrows" :D


Best

Klaus

Re: Using Little Arrows

Posted: Mon Mar 09, 2015 7:04 am
by Ultravibe
Thank you, Klaus!
This way is much comfortable! Don't need to evaluate where the value of scrollbar "goes": up or down ))))
Just two messages Increase and Decrease ))))
It's exactly what i'm lookin for!

Re: Using Little Arrows

Posted: Mon Mar 09, 2015 9:43 am
by Ultravibe
Klaus! By the way, is there a property of Scrollbar to ignore countinous mouse pushing?
I mean "one press = one action", and it wouldn't repeat to increase (or decrease) the value even if i hold mouse button and don't release it

Re: Using Little Arrows

Posted: Mon Mar 09, 2015 1:01 pm
by Klaus
Ultravibe wrote:Klaus! By the way, is there a property of Scrollbar to ignore countinous mouse pushing?
I mean "one press = one action", and it wouldn't repeat to increase (or decrease) the value even if i hold mouse button and don't release it
Not sure I understand, but I don't think there is a property for this.
Maybe you can "fake" it by simply scripting "mouseup" instead of any scrollbar message.

Re: Using Little Arrows

Posted: Mon Mar 09, 2015 3:03 pm
by Ultravibe
Klaus wrote:
Ultravibe wrote:Klaus! By the way, is there a property of Scrollbar to ignore countinous mouse pushing?
I mean "one press = one action", and it wouldn't repeat to increase (or decrease) the value even if i hold mouse button and don't release it
Not sure I understand, but I don't think there is a property for this.
Maybe you can "fake" it by simply scripting "mouseup" instead of any scrollbar message.
Actually, i've been searching the messages like "scrollbarInc" and "scrollbarDec" to simplify the scripts))))