Qualifier keys when button clicked



  • 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?



  • 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



  • 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



  • 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


Log in to reply