hello,
i red some older articles about entering a text in the vcb-value (user text) and learned, that it was not possible to enter letters in the vcb input.
is there - maybe in the latest sketchup versions - a way, to interrupt the shortcut-listener of sketchup, until enter is pressed after the vcb input (esecially for text)?
First of all, the VCB text can only be read from within a Ruby Tool.
I think that the shortcut problem still exists. You can test with ā¦
class MyTool
@@vcb = true
def self.go
Sketchup.active_model.select_tool(self.new)
end
def activate
puts "MyTool active."
@input = ""
end
def deactivate(view)
puts "MyTool deactived."
end
def enableVCB?
return @@vcb
end
def getMenu(menu, flags, x, y, view)
id = menu.add_item('Enable VCB?') {
@@vcb = !@@vcb
# reactivate because Sketchup only calls enableVCB? once:
self.class.go
}
menu.set_validation_proc(id) { @@vcb ? MF_CHECKED : MF_UNCHECKED }
end
def onKeyUp(key, repeat, flags, view)
puts "MyTool: onKeyUp()"
@input<<key.chr
puts( key == 13 ? "key: ENTER" : "key: #{key.chr}" )
end
# Called only when enableVCB is false and before onKeyUp().
def onReturn(view)
puts "MyTool: onReturn()"
puts "The text input was: #{@input}"
@input = ""
end
# Called only when enableVCB is true and before onKeyUp().
def onUserText(text, view)
puts "MyTool: onUserText()"
puts "The text input was: #{text}"
@input = ""
rescue => err
puts "Invalid entry (#{err.class.name})"
end
end # class