def Message ( self, msg, result ):
# Method A, querying a special key
bc = c4d.BaseContainer()
ok = c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_TAB, bc)
if ok:
if bc[c4d.BFM_INPUT_VALUE] == 1:
print "tab key"
return True # if you don't return here, the Tab key will still have the default influence on your dialog
# This can get really confusing...
ok = c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_ENTER, bc)
if ok:
if bc[c4d.BFM_INPUT_VALUE] == 1:
print "enter"
return True
# Method B - processing the input message, works nicely for normal keys
if msg.GetId() == c4d.BFM_INPUT:
if msg.GetInt32(c4d.BFM_INPUT_DEVICE) == c4d.BFM_INPUT_KEYBOARD:
print "KEYBOARD: "
print msg.GetString(c4d.BFM_INPUT_ASC)
return True # return True ONLY on keys you want to process, otherwise standard commands won't work anymore, as long as your dialog is active
return gui.GeDialog.Message(self, msg, result)