Second right-click ignored



  • On 02/03/2017 at 02:07, xxxxxxxx wrote:

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

    ---------
    Hi,
    I have simple ToolData based plugin class. I don't want to go into details but inside is something like multi-layer interaction with user and I need Right mouse button to switch between those layers.

    So in my Message function I have reaction to MSG_TOOL_ASK:

      
    Bool C4dUtilObj::Message(BaseDocument* doc,BaseContainer& data,Int32 type,void* t_data)  
    {  
      switch(type){  
          case MSG_TOOL_ASK:  
              {  
                  ToolAskMsgData* ask = (ToolAskMsgData* )t_data;    // cast nasty void*  
                  ask->use_rightmouse    = true;                        // we need right mouse button  
                  ask->popup_allowed    = false;                    // popup window is not allowed  
                  return true;  
              }  
              break;  
      }  
      return ToolData::Message(doc,data,type,t_data);  
    }  
    

    And in MouseInput is something like this:

      
    Bool C4dUtilObj::MouseInput(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, EditorWindow* win, const BaseContainer& msg)  
    {  
      // this is called just once if I clicked twice in very short time  
      QUALIFIER qualifier = (QUALIFIER)msg.GetInt32(BFM_INPUT_QUALIFIER);    // shift, ctrl, etc  
      
      switch(msg.GetInt32(BFM_INPUT_CHANNEL)){  
          case BFM_INPUT_MOUSERIGHT:  
               // some stuff  
          break;  
      }  
      return true;  
    }  
    

    The problem is when I click with right mouse button twice in very short time (like double click with right mouse) MouseInput is called just once and qualifier doesn't contain INPUT_DBLCLK flag. Even BFM_INPUT_DOUBLECLICK value in msg is false.

    Please let me know if there is some solution how to get two MouseInput calls or just one with proper msg.  It is important for fast work with my plugin. Thank you.



  • On 03/03/2017 at 03:30, xxxxxxxx wrote:

    Hi Miro,

    This is a limitation. Double click with the right mouse button can't be processed.
    But that's not a usual mouse interaction. Double click with the left mouse button is the standard.
    A solution would be to process left mouse double clicks with a Shift/Ctrl qualifier detection to vary the operations.



  • On 03/03/2017 at 04:20, xxxxxxxx wrote:

    Hi,
    thank you for information. I see, from what I wrote it looks like I need double click but in reality I just need to know that user clicked with right mouse twice, not just once.

    I agree that double click with right mouse is not standard way how to use mouse but it looks like a bug when MouseInput is called just once if two right clicks occurs in short enough time.

    PS: I used Shift/Ctrl qualifiers for constraints, so that's not an option.



  • On 03/03/2017 at 05:48, xxxxxxxx wrote:

    I'm afraid the mouse input detection only allows to process single right mouse clicks.
    We will add this to our list for future enhancements of the API.

    And one would argue that clicking a mouse button twice is double clicking but I won't start an endless debate hehe 🙂



  • On 06/03/2017 at 04:58, xxxxxxxx wrote:

    Thank you, that's great! 🙂


Log in to reply