TreeViewFunctions::InputEvent() CTRL+A



  • On 29/03/2013 at 07:13, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    I'm trying to catch when the user pressed Ctrl + A on the keyboard. But when the Ctrl qualifier
    is set, BFM_INPUT_ASC is an empty string.

    The following is the output for the following actions:

    • Click
    • Pressing 'a'
    • Click
    • Pressing Ctrl + 'a'
    MaskExportTreeModel::InputEvent
    BFM_INPUT_VALUE: 1
    BFM_INPUT_ASC: 
    MaskExportTreeModel::InputEvent
    BFM_INPUT_VALUE: 1
    BFM_INPUT_ASC: a
    MaskExportTreeModel::InputEvent
    BFM_INPUT_VALUE: 1
    BFM_INPUT_ASC: 
    MaskExportTreeModel::InputEvent
    BFM_INPUT_VALUE: 1
    BFM_INPUT_ASC: 
    CTRL!!
    

    And this is the corresponding code:

    Bool MyTreeViewFunctions::InputEvent(void* root, void* ud, GeUserArea* area,
                                         const BaseContainer& msg) {
        GePrint(__FUNCTION__);
        GePrint("BFM_INPUT_VALUE: " + LongToString(msg.GetLong(BFM_INPUT_VALUE)));
        GePrint("BFM_INPUT_ASC: " + msg.GetString(BFM_INPUT_ASC));
      
        if (msg.GetLong(BFM_INPUT_QUALIFIER) & QCTRL) {
            GePrint("CTRL!!");
        }
      
        return TreeViewFunctions::InputEvent(root, ud, area, msg);
    }
    

    Pressing Ctrl alone does not trigger an Input event, only when pressing Ctrl + 'some key' triggers
    the method. But the key pressed together with the qualifier is not given. How can I catch the
    Ctrl + 'a' key-press correctly?

    Thanks!

    -Niklas



  • On 29/03/2013 at 23:01, xxxxxxxx wrote:

    This should give you the ASCII decimal value for the key:

    LONG chn = msg.GetLong(BFM_INPUT_CHANNEL);
    


  • On 30/03/2013 at 00:32, xxxxxxxx wrote:

    Thank you David, that's it!


Log in to reply