PDA

View Full Version : Button and tool problem


SSaphire
06-19-2006, 05:51 PM
Hi,
I'm using Max 5 and writing a script that generate a number of buttons. When pressed the buttons set a variable and then start a tool. However I've found that if I press button A then button B, then try and press button A again the pressed action isn't called for that button.

I've tried added a stoptool before the starttool in the pressed action but it doesn't work. However if I type a stoptool into the listener window and execute it, I can click button A again.

Any help would be greatly appreciated.

Thanks

Wahooney
06-20-2006, 08:00 AM
Could you post your code here? It would make solving your problem easier.

SSaphire
06-20-2006, 10:20 AM
Hi Wahooney, the code's massive so I've made and example that illustrates the problem. If you run it with the listener window open, click button A and the "ButtonA Pressed" will be printed to the listener, then click button B, "ButtonB Pressed" is printed to the listener. Now press button A again and nothing is printed to the listener. If you then type stoptool MyTool into the listener and execute it, you will be able to click button A again and get the expected result "ButtonA Pressed".

If anyone knows why this is or has a work around for it your input would be greatly appreciated.

Here's the script -
global cMyVarG = ""
tool MyTool
(
-- do something with variable cMyVarG
)

rollout MyRollout "My Rollout"
(
button ButtonA "Button A" width:64 height:48
on ButtonA pressed do
(
cMyVarG = "A"
print "ButtonA Pressed"
stopTool MyTool
startTool MyTool
)

button ButtonB "Button B" width:64 height:48
on ButtonB pressed do
(
cMyVarG = "B"
print "ButtonB Pressed"
stopTool MyTool
startTool MyTool
)

)

MyFloater = newRolloutFloater "My Floater" 210 500 872 76

addRollout MyRollout MyFloater

CGTalk Moderation
06-20-2006, 10:20 AM
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.