Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    Qualifier keys when button clicked

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 320 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 09/02/2011 at 06:56, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R12 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I have a dialog with a button in it. When that button is clicked I'd like to know whether the user is holding down the Ctrl key or not. The docs for the GeDialog.Command() function imply that the status is returned in the base container passed in the function parameters, but I can't get it to work. The bare bones of the Command() function look like this:

      Bool MyDialog::Command(LONG id, const BaseContainer& msg)   
      {   
           Bool value;   
        
           switch(id)   
           {   
           case MY_BUTTON:   
                value = FALSE;   
                msg.GetBool(BFM_ACTION_DP_SUBSELECT, value);   
                if(!value)              // Ctrl not pressed   
                {   
                     // do something   
                }   
                else                    // Ctrl is pressed   
                {   
                           // do something else   
                }   
        
                break;   
              }   
      }   
      

      In this code, the 'else' code is never executed. Is this the right way to go about checking the key status? If it is, what am I doing wrong?

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 09/02/2011 at 07:58, xxxxxxxx wrote:

        Howdy,

        This is what I use to get the state of qualifier keys:

        BaseContainer state;
        GetInputState(BFM_INPUT_KEYBOARD, BFM_INPUT_CHANNEL, state);
        if(state.GetLong(BFM_INPUT_QUALIFIER) & QCTRL)
        {
        }
        

        Adios,
        Cactus Dan

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 09/02/2011 at 08:07, xxxxxxxx wrote:

          The docs are wrong. The container passed to Command contains following values:

            
          BFM_ACTION_ID  
          BFM_ACTION_VALUE  
          BFM_INPUT_QUALIFIER  
          

          To check for CTRL do something like this:

            
          Bool ListViewDialog::Command(LONG id, const BaseContainer &msg)  
          {  
            switch (id)  
            {  
                case GADGET_INSERT:  
                {  
                    if (msg.GetLong(BFM_INPUT_QUALIFIER) & QCTRL)  
                        GePrint("CTRL");  
                }  
                break;  
            }  
            return TRUE;  
          }  
          

          cheers,
          Matthias

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 09/02/2011 at 08:13, xxxxxxxx wrote:

            Hi Dan,

            Many thanks for that, it works perfectly! I did play around with GetInputState() before, but I found it a touch confusing with the large number of BFM_INPUT parameters and couldn't get it to work either. I'll have to investigate further.

            Thanks again,

            Steve

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