nudge objects...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
nudge objects...
Is it possible to nudge an object?
I know you can drag and drop, etc but can you use the up, down, left, right arrows to nudge an object?
I know you can drag and drop, etc but can you use the up, down, left, right arrows to nudge an object?
If you are in Edit mode and select an object then you can nudge it with the arrowkeys. If you press the shift key at the same time the object nudges 10 pixel.
If you are in Browse mode you could put into the message box (or do it by script) "select button 1" then this button is selected and you can nudge it. When you are done put "select empty" into the message box, hit return and the button is unselected.
regards
Bernd
If you are in Browse mode you could put into the message box (or do it by script) "select button 1" then this button is selected and you can nudge it. When you are done put "select empty" into the message box, hit return and the button is unselected.
regards
Bernd
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
TodayIsTheDay,
please explain a little more when you ask. I have no idea what you want. Do you want to move an arbitrary control with the arrowkeys or do you want to nudge just one control (button or field or whatever) with the arrowkeys.
If it is always one e.g. button you want to move then you would go differently about it compared to nudging different controls at different times.
You could set the loc of an object with the arrowKeys. Just look at what the loc of an object is and then set the loc to a pixel higher lower more to the right or left. That way you dont have to select the object before acting on them.
regards
Bernd
please explain a little more when you ask. I have no idea what you want. Do you want to move an arbitrary control with the arrowkeys or do you want to nudge just one control (button or field or whatever) with the arrowkeys.
If it is always one e.g. button you want to move then you would go differently about it compared to nudging different controls at different times.
You could set the loc of an object with the arrowKeys. Just look at what the loc of an object is and then set the loc to a pixel higher lower more to the right or left. That way you dont have to select the object before acting on them.
regards
Bernd
TodayIsTheDay,
make a new stack place 1 button on it and set the script of the card tothis should give you an idea. It would be advisable to avoid nudging the button off the card, you could implement that as an exercise.
regards
Bernd
make a new stack place 1 button on it and set the script of the card to
Code: Select all
on arrowKey whichKey
if the shiftKey is down then
put 10 into tnudge
else
put 1 into tnudge
end if
put the loc of button 1 into tOldLoc
switch whichKey
case up
subtract tnudge from item 2 of tOldLoc
set the loc of btn 1 to tOldLoc
break
case down
add tnudge to item 2 of tOldLoc
set the loc of btn 1 to tOldLoc
break
case left
subtract tnudge from item 1 of tOldLoc
set the loc of btn 1 to tOldLoc
break
case right
add tnudge to item 1 of tOldLoc
set the loc of btn 1 to tOldLoc
break
end switch
end arrowKey
regards
Bernd
-
- Posts: 56
- Joined: Sat Jun 20, 2009 2:41 pm
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Here's the nudge script from the MetaCard IDE:
on arrowKey which
if the short name of the defaultStack <> the short name of the topStack then pass arrowKey -- RG 090313
--
if (the selectedField) is not empty or the selectedObject is empty\
or word 1 of the selectedObject is "stack"\
or word 1 of the selectedObject is "card"\
and word 2 of the selectedObject is not among the items of "field,button,image,player,scrollbar,graphic"
then pass arrowKey
lock screen
local diff
if the shiftkey is down
then put 10 into diff
else put 1 into diff
repeat for each line l in the selectedObjects
switch which
case "left"
set the left of l to the left of l - diff
break
case "right"
set the left of l to the left of l + diff
break
case "up"
set the top of l to the top of l - diff
break
case "down"
set the top of l to the top of l + diff
break
end switch
end repeat
unlock screen
end arrowKey
on arrowKey which
if the short name of the defaultStack <> the short name of the topStack then pass arrowKey -- RG 090313
--
if (the selectedField) is not empty or the selectedObject is empty\
or word 1 of the selectedObject is "stack"\
or word 1 of the selectedObject is "card"\
and word 2 of the selectedObject is not among the items of "field,button,image,player,scrollbar,graphic"
then pass arrowKey
lock screen
local diff
if the shiftkey is down
then put 10 into diff
else put 1 into diff
repeat for each line l in the selectedObjects
switch which
case "left"
set the left of l to the left of l - diff
break
case "right"
set the left of l to the left of l + diff
break
case "up"
set the top of l to the top of l - diff
break
case "down"
set the top of l to the top of l + diff
break
end switch
end repeat
unlock screen
end arrowKey
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn