Page 1 of 1
Set checkbox checked - chicken and egg?
Posted: Thu Jul 23, 2009 1:30 pm
by JeffTucker
I'm doubtless missing something here. I have a checkbox in a custom dialog. How can I set its initial value?
I have tried to use the value in a hidden label caption, but if the rule is to set the checkbox to true if the label caption is true, then I'll never get the checkbox into the unchecked state because the label never changes and keeps resetting the checkbox! The program spirals into an infinite loop and dies. There does not appear to be an Object behavior for a checkbox to receive Information.
I'm using version 8.
Posted: Thu Jul 23, 2009 7:22 pm
by MichaelNesmith
That's not how you do it - you bind the check-box to an MSIcode script variable. Use the other tab after double-clicking the check-box to do the binding and pre-define the variable in your script before showing the dialog.
Posted: Fri Jul 24, 2009 12:32 am
by ALive
Hi, Jeff!
You can see how it's made inside "maintenance" default dialog. See the binding for Radio buttons (Second Tab: Object Behavior, The Field: Writes Values to Variable). This binding object works in two ways: read and write.
For check boxes it's the same way.
Also, you can see how Check Box works inside "Finish" dialog.
Hope this helps!
That worked!
Posted: Fri Jul 24, 2009 11:51 am
by JeffTucker
I was mislead by the extra dropdown in the Control Behavior tab that says the control receives information from ... (some variable), but in the case of the checkbox, it is disabled. In the case of an edit field, it is enabled. Doesn't seem symmetric.
Posted: Mon Jul 27, 2009 6:38 am
by ALive
Yeah, agree with you Jeff.
I'll explain how it works: if you specify "Receives Information" text field, the text box will be "Read Only" (a property that i'm desperately need, b.t.w.). But if you provide a variable inside "Writes information" text field the control behavior will be Read/Write. Same way for other controls. CheckBox does not have any means in ReadOnly mode (it could only be Disabled or be invisible). That's why it does not has "Receive Info" property enabled inside visual designer.
I hope my description was quiet sufficient
Have a nice day!