A problem with checkbox in COFFEE



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

    On 06/10/2004 at 09:45, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.0 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    I'm writing an ExpressionPluginTag that uses a modal dialog. I created a checkbox using this code:

        
        
        AddCheckbox(10,0,10,10,"Tag active");
    

    where the first argument (10) is the item id. It works well and the checkbox is visible on the dialog. The function GetCheckbox(10) works well also and returns the right checkbox state. The function SetCheckbox(10, flag) instead doesn't works and returns FALSE even if I pass it a constant flag.
     
    Some suggestions?...



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

    On 06/10/2004 at 11:47, xxxxxxxx wrote:

    What is 'flag' set to? The second argument should be TRUE or FALSE (or a var set to one of these). Otherwise, more code may be necessary to see what's going on.



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

    On 07/10/2004 at 01:35, xxxxxxxx wrote:

    The 'flag' parameter is a boolean variable set to TRUE or FALSE, anyway this is the full code:

        
        
        
        
        class dialog : GeModalDialog  
        {  
         public:  
         dialog(act);  
         CreateLayout();  
         Command(id,msg);  
           
         var active;  
        }
        
        
        
        
        dialog::dialog(act)  
        {  
         super();  
         active = act;  
         SetCheckbox(10, active);  
        }
        
        
        
        
        dialog::CreateLayout()  
        {  
          SetTitle("MixedHierarchy");  
          AddStaticText(11100,0,100,10,"Tag active",0);  
          AddCheckbox(10,0,10,10,"Tag active");  
          AddDlgGroup(DR_DLGGROUP_OK | DR_DLGGROUP_CANCEL);  
        }
        
        
        
        
          
        dialog::Command(id,msg)  
        {  
         active = GetCheckbox(10);  
         return TRUE;  
        }
        
        
        
    

    The dialog constructor is called in the plugin class with:

        
        
        
        
        MyExpressionPluginTag::Edit()  
        {
        
        
        
        
         // here 'active' is a member variable of the class 'MyExpressionPluginTag'  
         var d = new(dialog, active);
        
        
        
        
         if(d->Open(-1,-1))  
         {...  
         } 
        
        
        
        
          return TRUE;  
        }
        
        
        
    

    It works well, except for the dialog construction phase, where the function SetCheckbox(10, active) always returns FALSE. As I said the function doesn't work even if I call it with a constant argument, like SetCheckbox(10, TRUE).



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

    On 07/10/2004 at 03:36, xxxxxxxx wrote:

    Ok I solved the problem.
    The function SetCheckbox(10, active) has to be called in the dialog::CreateLayout(), just after the Addcheckbox(), and not in the constructor.
     
    Thanks anyway...



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

    On 07/10/2004 at 08:16, xxxxxxxx wrote:

    Yes, I was just about to say that myself. :)

    CreateLayout() is where the dialog reads in the dialog resource and/or where you programmatically create C4DGadgets. The checkbox doesn't yet exist in the dialog constructor. You should also use Init() for setting members and gadgets initially.

    Robert


Log in to reply