CommandData and ctrl-key

  • On 09/04/2018 at 04:01, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R19 
    Language(s) :     C++  ;

    Hi again,

    I guess I already know the negating answer to this, but still hoping to get some hints or tips from this.
    The context is as follows:
    I have a dialog with userarea and have created a few CommandData in order to let the user switch between different drawing modes. Each CommandData represents a drawing mode.
    When user switches between modes the userarea is updated, drawing information in the current requested mode.

    I am now playing with the idea to perform some specific actions when user switches between modes, but only when user holds the ctrl-key pressed.

    I don't really want to introduce the cogwheel for each CommandData, as I don't want to present "options" to the user. I also don't want to introduce separate CommandData/Icons/menu-entries to perform the specific action when switching.

    Is there a way to detect when user holds down ctrl key when pressing a CommandData icon in a palette (or in the main plugin's menu)? I doubt there is. Other options/alternatives?

    I don't mind using subids per CommandData to indicate the regular switching from one mode to another or the switching + extra action. But how to steer these different subids, without providing a different icon/menu-entry per subid?


  • On 10/04/2018 at 01:50, xxxxxxxx wrote:

    Hi C4DS,

    You can call GetInputState to know the current state of an input event.
    For a CommandData the right place to do it is in the Execute function.

    virtual Bool Execute(BaseDocument* doc)
    	BaseContainer msg;
    	if (GetInputState(BFM_INPUT_KEYBOARD, KEY_CONTROL, msg))
    		if (msg.GetBool(BFM_INPUT_VALUE))
    	return true;

    Please let me know if you need anything else.


  • On 11/04/2018 at 11:54, xxxxxxxx wrote:

    Thanks for that Maxime.
    I didn't realize that GetInputState was available outside of GeDialog and GeUserArea context.

Log in to reply