[Closed] buttonup canceled code?
Ok im usiung the following code, and it doesnt seem to work, its supposed to set mycanceled to true if the user rightclicks the spinner, in this case no matter what value i give it it just gives out the value false.
Any idea why this is?
Thanks
on myVTile buttonup myCanceled do
(
print myCanceled
if myCanceled == True do
(
print "poo"
myUTile.value = 1
)
)
Try passing the variable by reference instead of by value:
on myVTile buttonup &myCanceled do
(
print myCanceled
if myCanceled == True do
(
print "poo"
myUTile.value = 1
)
)
If haven’t tried this, but it may work.
The <in_Cancel> argument is only set to true when you cancel the spinner change, not just when you right-click it. Just like with any operation in max, you can cancel a dragging action (left-click + drag) by pressing the right mousebutton while still holding the left mousebutton. Doing this on the spinner control will give you an <in_Cancel> value of true.
The by-reference sign & is not needed btw.
- Martijn
hi Gibbz
According to the MaxScript Referance the way to catch a Button up event is
on <spinner> buttonup do <expr>
[font=Verdana]
As far as i can make out the scipt does not[/font][font="] distinguish between [/font]a right click cancel event and a left click button up event. (Although I haven’t checked Max 8)
I guess what you would need to do would be something like this…
On <spinner> buttondown do test = <Spinner>.value
On <spinner> buttonup do
(
if test == <Spinner>.value do
(
–It’s a right click Function
myUTile.value = 1
)
)
Although you can look at the mouse button states directly using
mouse.buttonStates
hi Martijn
Is that < in cancel > argument new to max 8 ? I haven’t seen it before.
Yes a lot of UI controls have new events and some events (like the spinner control) have changed.