Using Little Arrows
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Using Little Arrows
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
			
			
									
									
						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
- 
				sefrojones
- Livecode Opensource Backer 
- Posts: 447
- Joined: Mon Jan 23, 2012 12:46 pm
Re: Using Little Arrows
Do you mean the arrow keys? If so, check out the "arrowkey" message in the dictionary.
--Sefro
			
			
									
									
						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 arrowkeyRe: Using Little Arrows
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
			
							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
- Attachments
- 
			
		
				- little_arrows.jpg (14.51 KiB) Viewed 10990 times
 
Re: Using Little Arrows
Aha, this is actually a scrollbar, with the type set to littlearrows. So you can use the scrollbarDrag message:
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.
			
			
									
									
						Code: Select all
on scrollbarDrag tThumbPos
   put tThumbPos into field 1
end scrollbarDragNote 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
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...
			
			
									
									
						Just detect which arrow...
Re: Using Little Arrows
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
			
			
									
									
						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
Yes,Craig, thank you!
			
			
									
									
						Re: Using Little Arrows
How about this;
Simon
			
			
									
									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 mouseUpSimon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
						Re: Using Little Arrows
This should work:
Best regards
Jean-Marc
			
			
									
									Code: Select all
on scrollbarDrag tThumbPos
   if tThumbPos > fld 1 then
      put "up"
   else
      put "down"
   end if
   put tThumbPos into field 1
end scrollbarDragJean-Marc
https://alternatic.ch
						Re: Using Little Arrows
Jean-Marc, thank you!
I do the same algorhythm and it works!
But it's much better the way that Simon advised)))))
			
			
									
									
						I do the same algorhythm and it works!
But it's much better the way that Simon advised)))))
Re: Using Little Arrows
Hi guys,
use "on scrollbarLineDec" and "on scrollbarLineInc" together with an appropiate value
for "lineInc" in the inspector for the "little arrows" 
 
Best
Klaus
			
			
									
									
						use "on scrollbarLineDec" and "on scrollbarLineInc" together with an appropiate value
for "lineInc" in the inspector for the "little arrows"
 
 Best
Klaus
Re: Using Little Arrows
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!
			
			
									
									
						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
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
			
			
									
									
						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
Not sure I understand, but I don't think there is a property for this.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
Maybe you can "fake" it by simply scripting "mouseup" instead of any scrollbar message.
Re: Using Little Arrows
Actually, i've been searching the messages like "scrollbarInc" and "scrollbarDec" to simplify the scripts))))Klaus wrote:Not sure I understand, but I don't think there is a property for this.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
Maybe you can "fake" it by simply scripting "mouseup" instead of any scrollbar message.
