Quit Current Tool
-
I'm creating a tool, and there are certain situations where it's inappropriate to use the tool (the user does not have the correct type of component selected). I can display an error message easily enough, but how do I then quit the tool? CB.
-
hm... I've not used it - but maybe
Tools.pop_tool
?
http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/tools.html#pop_tool -
You could use a validation_proc to enable/disable the Tool button and/or menu. There would not be an opportunity to open a message box - the tool would simple not be available.
-
Yes, validation_proc is the correct solution for me. Don't even start the tool if we're not in the correct state. Thanks, Jim. CB.
-
Best to stop the tool running if the circumstances are wrong.
Assuming that you can select the 'wrong thing' within the tool later...
After your error message...Sketchup.send_action("SelectSelectTool;") return nil
should do it ?
Appropriate if you error message says to select something better / different ?? -
Thanks Tig. My tools are specific to a very specialized group of users (timber framers), so they'll know what should be selected. I think having the tool grayed out on the menu is all I need to do. CB.
Advertisement