GetInputEvent - Enter Key

  • On 12/09/2014 at 17:21, xxxxxxxx wrote:

    I have a script / command plugin. On the main dialog is a text edit field, and a save button. How would I capture the input event of the enter key while in the dialog and have that run commands?


  • On 16/09/2014 at 03:17, xxxxxxxx wrote:


    It seems there is no special Event triggered when "Enter" was pressed. But you can check if "Enter" is pressed:

      def Message(self, msg, result) :  
          bc = c4d.BaseContainer()  
          ok = c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.KEY_ENTER, bc)  
          if ok:  
              if bc[c4d.BFM_INPUT_VALUE] == 1:  
                  print ("Enter is pressed!")  
          return super(MyDialog, self).Message(msg,result)  

    GetInputState let's you check any keyboard or mouse property. The "Enter" key is defined via c4d.KEY_ENTER. If the BFM_INPUT_VALUE is 1 the key is pressed.

    Best wishes,

Log in to reply