Catch Enter-message in Subdialog and GeDialog



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

    On 20/11/2009 at 04:28, xxxxxxxx wrote:

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

    ---------
    Hello,

    my problem is,that I sometimes get a message for Enter-Key in my TreeView and sometimes not. I have a maindialog- and a subdialogclass.

    SubDialog:

      
    class MySubDialog1: public SubDialog   
    {   
    private:   
              TreeViewCustomGui* m_tree;   
              TreeViewFunctions m_functable;   
      
    public:   
         MySubDialog1()   
         {   
              m_tree = NULL;   
         }   
      
         virtual Bool CreateLayout(void)   
         {   
              BaseContainer treedata;   
      
              treedata.SetLong(TREEVIEW_BORDER,BORDER_BLACK);   
              treedata.SetBool(TREEVIEW_HIDE_LINES,TRUE);   
              treedata.SetBool(TREEVIEW_RESIZE_HEADER,TRUE);   
              treedata.SetBool(TREEVIEW_HAS_HEADER,FALSE);   
    #if API_VERSION >= 9700   
              treedata.SetBool(TREEVIEW_ALTERNATE_BG,TRUE);   
    #endif   
              treedata.SetBool(TREEVIEW_CURSORKEYS, TRUE); TODO enable this if tree redraws too slow   
      
              GroupBegin(GROUP_TREE,BFV_SCALEFIT|BFH_SCALEFIT,1,0,"",0);   
              {   
                   m_tree = (TreeViewCustomGui* )AddCustomGui(TREE_RESULTS,CUSTOMGUI_TREEVIEW,String(),BFH_SCALEFIT|BFV_SCALEFIT,0,0,treedata);   
                   m_tree->SetRoot(GetActiveDocument(), &m;_functable, NULL);   
                   BaseContainer layout;   
                   layout.SetLong(1,LV_USER);   
                   layout.SetLong(2,LV_TREE);   
                   layout.SetLong(3,LV_USER);   
                   layout.SetLong(4,LV_USER);   
                   m_tree->SetLayout(4,layout);   
                      
                   m_tree->SetColumnWidthUser(1, 18);                  
              }   
              GroupEnd();   
      
              return TRUE;   
         }   
      
         void activate()   
         {   
              if(m_tree)   
                   Activate(TREE_RESULTS);   
         }   
      
      
         TreeViewCustomGui* getTree()   
         {   
              return m_tree;   
         }   
      
         ResultTree* getResultTree()   
         {   
              return &m;_functable;   
         }   
      
            
            
         virtual LONG Message(const BaseContainer& msg, BaseContainer& result)   
         {   
              //GePrint(LongToString(msg.GetId()));   
              if(msg.GetLong(BFM_ACTION_ID) == 1)   
              {   
                   //GePrint("enter");   
              }   
      
              if(msg.GetId() == BFM_INPUT)   
              {   
                   if ( msg.GetLong(BFM_INPUT_CHANNEL) == KEY_ENTER)   
                   {   
                        //GePrint("enter+shift");   
                   }   
              }   
      
              return SubDialog::Message(msg,result);   
         }   
    };   
    

    and connect the subdialog in my .res of the main dialog with SUBDIALOG TREE1 { SCALE_H; SCALE_V; } and AttachSubDialog(&subdialog;,TREE1);.

    if I press the enterbutton and i haven't klicked in the treeview or activated(Focus in MainDialog), i can get a message for enter key and catch it with :

      
    if(msg.GetLong(BFM_ACTION_ID) == 1)   
    

    But i can't catch a message for Shift+Enter:

      
    if(msg.GetId() == BFM_INPUT)   
         {   
                   if ( msg.GetLong(BFM_INPUT_CHANNEL) == KEY_ENTER)   
    

    And after Clicking or Activation the treeview(Focus in tree) it`s vice versa.

    Is there a possibility to catch the same message for both focus cases?
    Any ideas?

    Thanks, coffeemax


Log in to reply