XML Attribute - Select checkbox - Advanced Installer Community
Olidev
Posts: 7
Joined: Fri Nov 18, 2016 7:52 pm

XML Attribute - Select checkbox

Hi,

I have a project that has a XML file with attributes that contains the property value of checkboxes in dialogs. The values are correctly saved which mean when the checkbox is selected the value in the XML is 1 and when unselected it's empty. I would like to select(check) the checkboxes when the property value is equal to 1 and unselect(uncheck) it if the property value is empty.

I tried by setting a published event "Set installer property value" on the next button in the previous dialog where are my checkboxes are.

Event1:
Property: CHECKBOX_1_PROP
Argument: {}
Condition: CHECKBOX_1_PROP <> "1"

Event2:
Property: CHECKBOX_1_PROP
Argument: 1
Condition: CHECKBOX_1_PROP = "1"

Unfortunately, it doesn't work. Am I doing something wrong? What is the best way to remember checkboxes selected including in the ShortcutsDlg and ExitDialog to select them again in the next product version with a XML File.

Best regards,
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: XML Attribute - Select checkbox

Hi and welcome to Advanced Installer forums.

Please take a look on the "Saving context between installations" which debates a similar scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Olidev
Posts: 7
Joined: Fri Nov 18, 2016 7:52 pm

Re: XML Attribute - Select checkbox

Hi,

Thank you for your answer but I still have the same issue with the Set persistent property. The checkbox is not check or unchecked according to the property value.

The problem doesn't seem how my properties are saved but my conditions to check or unchecked the checkbox. If I put a textbox, the textbox content is according to what is saved in the XML or in the persistent property.

My conditions are in the Published Events of the Next button of the previous Dialog:

Event1:
Property: CHECKBOX_1_PROP
Argument: {}
Condition: CheckBoxTest <> "CheckBox"

Event2:
Property: CHECKBOX_1_PROP
Argument: "CheckBox"
Condition: CheckBoxTest = "CheckBox"

CHECKBOX_1_PROP is the property name. "CheckBox" is the value of the checkbox. CheckBoxTest is the persistent property.

Thank you for your support
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: XML Attribute - Select checkbox

Hi,

If you want to use the "Set persistent property" method to preserve the state of a checkbox, you need to follow the instruction detailed in the "Installer values reload while upgrading" thread.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Olidev
Posts: 7
Joined: Fri Nov 18, 2016 7:52 pm

Re: XML Attribute - Select checkbox

Hi,

Thank you for your support. It works for my checkboxes in the ShortcutsDlg but how can I save the state of the RUNAPPLICATION and VIEWREADME checkboxes in the ExitDialog into my XML File? By default, the "Launch application" option is checked. If I unchecked it the value doesn't change in the XML file. Same thing with the "View readme file" option.

Best regards,
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: XML Attribute - Select checkbox

Hi,

The XML file is changed during the install stage which is before the "ExitDialog", so any property changed on that dialog cannot be updated in the XML file. In order to achieve this, you can create your own custom action that updates the state of those properties in the XML file and execute that custom action on the "Finish" button of the "ExitDialog" dialog.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Olidev
Posts: 7
Joined: Fri Nov 18, 2016 7:52 pm

Re: XML Attribute - Select checkbox

Hi,

That's what I thought, I created a custom action of type "Set Installer Property" . In the Property field I wrote RUNAPPLICATION and in the value field: [RUNAPPLICATION] but it doesn't save the property into the XML File and put the event in the Published Events of Finish button of the ExitDialog.

What type of custom action do I need to create to save a property into a XML file?

Thank you for your support!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: XML Attribute - Select checkbox

Hi,

Adding a "Set installer property" custom action on the "Finish" button will not make any difference. You need to create, for example, a VBScript custom action, a custom action written in C# or a custom action written in C++, that modifies your XML file and update the values you need.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”