Set checkbox checked - chicken and egg?

Got a problem you cannot solve? Try here.
Post Reply
JeffTucker
Posts: 62
Joined: Thu Mar 19, 2009 11:07 am
Contact:

Set checkbox checked - chicken and egg?

Post 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.
Fiddling with technology
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post 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.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
ALive
Posts: 109
Joined: Mon Apr 27, 2009 5:54 am
Location: Russia

Post 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!
JeffTucker
Posts: 62
Joined: Thu Mar 19, 2009 11:07 am
Contact:

That worked!

Post 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.
Fiddling with technology
ALive
Posts: 109
Joined: Mon Apr 27, 2009 5:54 am
Location: Russia

Post 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!
Post Reply