Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

CommandData and ctrl-key

Author
Message
  Topic Search Topic Search
C4DS View Drop Down
Member
Member


Joined: 2015 Dec 01
Online Status: Offline
Posts: 235
Direct Link To This Post Topic: CommandData and ctrl-key
    Posted: 2018 Apr 09 at 4:01am

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

Back to Top
MaximeA View Drop Down
Forum Moderator
Forum Moderator

Forum Moderator

Joined: 2018 Jan 04
Location: France - Nantes
Online Status: Offline
Posts: 119
Direct Link To This Post Posted: 2018 Apr 10 at 1:50am
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
MAXON
SDK Specialist
Back to Top
C4DS View Drop Down
Member
Member


Joined: 2015 Dec 01
Online Status: Offline
Posts: 235
Direct Link To This Post Posted: 2018 Apr 11 at 11:54am
Thanks for that Maxime.
I didn't realize that GetInputState was available outside of GeDialog and GeUserArea context.
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.