PDA

View Full Version : buttonup canceled code?


Gibbz
12-15-2005, 09:46 AM
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
)
)

pindercarl
12-15-2005, 03:42 PM
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.

Gibbz
12-15-2005, 09:28 PM
Didnt work unfortunatley.

Thanks tho...

magicm
12-15-2005, 09:59 PM
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

Kenzor
12-15-2005, 10:14 PM
hi Gibbz

According to the MaxScript Referance the way to catch a Button up event is

on <spinner> buttonup do <expr>

As far as i can make out the scipt does not distinguish between 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

Kenzor
12-15-2005, 10:19 PM
hi Martijn

Is that < in cancel > argument new to max 8 ? I haven't seen it before.

magicm
12-15-2005, 10:51 PM
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.

CGTalk Moderation
12-15-2005, 10:51 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.