Checkbox Checked State And Next/Back Button - Advanced Installer Community
sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Checkbox Checked State And Next/Back Button

I have a series of check-boxes whereby if the user selects the check-box an associated property is set to "1". If the user unchecks a check-box then when they select the Next button this code fires to set the property to 0:

Code: Select all

    Event_______|_Argument___|_Condition______________
    [PROPERTY]  |     0      | AI_INSTALL AND PROPERTY<>1
I have two problems now. When they click Next you can see the check-boxes get "checked" again. When they click the Back button the check-boxes are checked again, almost like they are using a property value of 0 and 1 to mean "Selected".
Scott Jeslis
Senior Software Engineer
Cicero, Inc.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Checkbox Checked State And Next/Back Button

Hi Scott,

In order to reset a property value (set it to null), you can edit the custom action properties like this:

Code: Select all

 Event_______|_Argument___|_Condition______________
 [PROPERTY]  |     {}     | AI_INSTALL AND PROPERTY
Please let me know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Checkbox Checked State And Next/Back Button

Dan,

My problem with adding what you suggest is when they uncheck a check-box associated with PROPERTY I want PROPERTY to contain 0 because those are mapped to settings in an XML config file. Nulling PROPERTY at that point might cause an empty string value to be written to the XML Config file?
Scott Jeslis
Senior Software Engineer
Cicero, Inc.
sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Checkbox Checked State And Next/Back Button

I believe what I did previously to get around this was to have a Set Installer Property CA for each PROPERTY that if set to Null would set it 0, these of course happened after the UI sequence.

I was hoping for a cleaner way :cry:
Scott Jeslis
Senior Software Engineer
Cicero, Inc.
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Re: Checkbox Checked State And Next/Back Button

I'm also curious about this. I recently came across a similar issue, where I tried to pass in CB_PROPERTY through the command line. I expected the following:

CB_PROPERTY="1" > The checkbox is checked.
CB_PROPERTY="0" > The checkbox is not checked.

However, it appears the checkbox doesn't work this way. Any non-null value results in the box being checked. Some more info here: http://stackoverflow.com/questions/2992 ... mmand-line

This behavior seems non-intuitive to me, but, it sounds like this was an intentional design choice (by Microsoft i guess?). Anyways, It's not a solution to your issue, but, maybe it helps explain what is happening.
sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Checkbox Checked State And Next/Back Button

Thanks codesynergy!

We use command line as well. Thing is I did have this working at one time (original AI install I did is 3 years old now) and in the present we decided to define all our global properties inside the main installer's Installer Properties dialog in order to set defaults and allow customers to edit the MSI for transforms.

Unfortunately, I think I broke it because I deleted several CAs and not remembering what they were for (side note: sure which there was a comment field for CAs just to document behaviors :-). Check for a null or non-existent property and setting to 0 also fixed when global properties were NOT passed on the command line. I'm guessing this will be the fix again but when I have 10 global properties that's 10 extra CAs I will need. It seems a waste to define properties, set a default, associate with a checkbox then the get "nulled" then recreate them with 0 or some other default.

Just hoping in the last 3 years a better solution was possible.
Scott Jeslis
Senior Software Engineer
Cicero, Inc.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Checkbox Checked State And Next/Back Button

Hi Scott,

Indeed, the unselected state of a checkbox control sets the property assigned to the related control to null. For details, please check the CheckBox Control article.

@codesynergy: Thank you for your replies!

If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”