Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    CommandData and ctrl-key

    SDK Help
    0
    3
    527
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      User Information:
      Cinema 4D Version:   R19 
      Platform:      
      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?

      Thanks

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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))
        			GePrint("CTRL");
          
        	return true;
        };
        

        Please let me know if you need anything else.

        Cheers,
        Maxime

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post