mercredi 19 août 2015

SketchUp API: How to add a check box to a menu item

I don't see it anywhere in the Ruby API documentation but just in case I'm missing something...

I'm writing a plugin for SketchUp and I'm trying to add some options to the menu bar. One of my options would work best as a checkbox, but right now I have to have two separate buttons. Is there a way to create a checkbox menu item with the Ruby API?

Here's what I had to do instead:

foo = true
UI.menu("Plugins").add_item("Turn foo_option on") { @foo = true }
UI.menu("Plugins").add_item("Turn foo_option off") { @foo = false }

...and then I just use foo to change the options. Is there a cleaner way to do this?

Aucun commentaire:

Enregistrer un commentaire