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:
Cinema 4D Version: 9.0
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:
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.
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.
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
active = act;
AddDlgGroup(DR_DLGGROUP_OK | DR_DLGGROUP_CANCEL);
active = GetCheckbox(10);
The dialog constructor is called in the plugin class with:
// here 'active' is a member variable of the class 'MyExpressionPluginTag'
var d = new(dialog, active);
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).
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.
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.