Strange that it works for me, because in my API world the UI::Command
instance object itself has a set_validation_proc
instance method. The newly created command object is what I am calling the set_validation_proc
method upon, as it is what is returned from the call to ::new()
.
I paste this into the console, and it works fine:
UI.menu('View').add_item UI::Command::new('Dimensions') {
opts = Sketchup::active_model.rendering_options
opts['DisplayDims']= !opts['DisplayDims']
}.set_validation_proc {
Sketchup::active_model.rendering_options['DisplayDims'] ? MF_CHECKED : MF_UNCHECKED
},7
UI.menu('View').add_item UI::Command::new('Text') {
opts = Sketchup::active_model.rendering_options
opts['DisplayText']= !opts['DisplayText']
}.set_validation_proc {
Sketchup::active_model.rendering_options['DisplayText'] ? MF_CHECKED : MF_UNCHECKED
},9
Resulting in: