Setting Checkbox based on a property - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

drivard
Posts: 50
Joined: Wed Dec 05, 2007 10:14 pm

Setting Checkbox based on a property

Is it possible to set a checkbox based on the value of a property?
I have a need to set the checkbox at build time. I had hoped to do this by setting a property when I generate the AIP file at build time.
I also have a related need to show or hide the checkbox based on another property.

We are using command files when we build. Trying to manipulate the checkbox property at build is not working.
(in this case, the checkbox is named DESKTOP_SHORTCUT, and the command is SetProperty DESKTOP_SHORTCUT="0" (or "1) )

I know I could probably accomplish this by directly modifying the XML at build, but I really want to avoid it if I can.

thanks,
Dennis
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Setting Checkbox based on a property

Hello,

There appears to be a limitation that prevents checking a checkbox from the command line. We have added an improvement on our TODO list which will be available in the next version of Advanced Installer.
I also have a related need to show or hide the checkbox based on another property.
You can achieve this by selecting your checkbox, then on the Control Conditions tab adding a new Condition. Set the condition to:

Code: Select all

TEST = "hide"
and the Action to "Hide". Now, when adding from the command line a property named TEST with the value "hide", the checkbox will be hidden. Adding the property TEST with a value different than "hide" will make your checkbox visible again.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
drivard
Posts: 50
Joined: Wed Dec 05, 2007 10:14 pm

Re: Setting Checkbox based on a property

Thank you very much Gabriel, that sounds like it will work nicely!
drivard
Posts: 50
Joined: Wed Dec 05, 2007 10:14 pm

Re: Setting Checkbox based on a property

Can you tell me what will happen if the checkbox is disabled? Will its value still get read by the published button event for my dialog? The event is a DoAction with condition = AI_INSTALL AND CHECKBOX_VAL="1"

if disabled controls do not fire events, it would be possible for me to use the technique you posted above to also disable the checkbox, as well as hide it.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Setting Checkbox based on a property

Hello,

The value of your checkbox's property will still be read even if your checkbox is hidden or disabled. Therefore, your DoAction will be executed since CHECKBOX_VAL can evaluate to "1" even if the checkbox is hidden/disabled.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
drivard
Posts: 50
Joined: Wed Dec 05, 2007 10:14 pm

Re: Setting Checkbox based on a property

Thank you. I got around that issue by having my DoAction condition also check the value of the property I am using to disable the control. It worked pretty nicely, even if it is a hack.

Return to “Common Problems”