raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Binding check box value of registry entry to checkbox control

Hi,

The default value of checkbox in dialog is set as : "selected":"True", "value":"checked"

if it is checked in dialog, its value in registry is saved as "checked"
if it is unchecked , it is saved as empty in registry.

The problem now is, the registry value is not binding to check box when it is empty in registry(unchecked in dialog)

Please suggest me how to bind registry value to checkbox in dialog?

Regards
Raghu
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Binding check box value of registry entry to checkbox control

Hello Raghu,

I'm afraid I don't fully understand what you are trying to achieve. If you want to write a value in registry regardless the state of the checkbox, you can use another property whose values can be "checked" or "unchecked" and use the method described in the "Registry Entry for CheckBox is not saved" post.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Binding check box value of registry entry to checkbox control

Hi,

Thanks for your reply.

I want to achieve this:
while running the installer, I want the checkbox in dialog should be in "checked" state, when the value of this property in registry is saved as "checked".
and it should be "unchecked" when the value in registry is "unchecked".

I am able to save check box value in registry from email settings wizard.But unable to bind to checkbox state.

Regards
Raghu
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Binding check box value of registry entry to checkbox control

Hi,

Please look into the attached sample project.In this, I added the checkbox with property name CHECKBOX_1_PROP and set this property as persistent.

steps to reproduce the issue
..............................................
1.Runt the the aip.
2.uncheck the checkbox( with text : CheckBox to Test binding registry value).
3.you can see the value of the checkbox in registry after installation is finished.
4.Now i changed the product version to later to upgrade existing product.
5.Now the check box value should be in unchecked state in the dialog, but it is still in checked state, this is the issue I need to solve.

Please help me to solve this problem
Thanks
Raghu
Attachments
CheckBoxState.aip
(13.29 KiB) Downloaded 471 times
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Binding check box value of registry entry to checkbox control

Hello Raghu,

To achieve what you need you should just set your checkbox property (CHECKBOX_1_PROP) to an empty value when the search fails (more exactly when the search result is empty string). However, when the search result is empty string Windows Installer does not delete (or set to empty string) the search associated property. This is the reason why your checkbox is always checked when you use the same property for the search result and for the checkbox too.

To avoid this behavior you can use an auxiliary property (i.e. CHECKBOX_STATE) for your registry value search. Then, in the "Init Events" list of your checkbox dialog (i.e. "WelcomeDlg") add a "Set installer property value" event like this:
  • Event: Set installer property value
    Property: CHECKBOX_1_PROP
    Argument: [CHECKBOX_STATE]
    Condition: 1
Also, you can find attached a sample build with Advanced Installer 13.2.2 which implements such a scenario.

All the best,
Daniel
Attachments
sample.zip
(5.84 KiB) Downloaded 329 times
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Binding check box value of registry entry to checkbox control

Hi Daniel,

Thanks for your solution.

Your solution is working when the requirement is the "checkbox should be is unchecked by default".
I want the checkbox should be checked by default.

Please suggest me how to create install parameter without any value and checkbox value with default checked.


Thanks
Raghu
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Binding check box value of registry entry to checkbox control

Hello Raghu,

For your last requirement, you should just use another search which will check if the "CHECKBOX_1_PROP" registry value exists. If it does, then you should set the check box property to the state you found written in the registry, otherwise it means that there is a first installation scenario and the check box should be checked (i.e. you should not set the check box property to the state you searched in the registry).

Here are the setting you can add on top of the previous sample I attached:
1. go to "Search" page and add a new extended search (CHECKBOX_1_PROP_EXISTS) like this:
  • Criteria: Registry value exists
    Registry Value: HKLM\Software\[Manufacturer]\[UpgradeCode]\CHECKBOX_1_PROP
2. go to "Dialogs" page and select the "Init Events" tab of "WelcomDlg" dialog
3. set the "Condition" field of the existing init event like this:

Code: Select all

CHECKBOX_1_PROP_EXISTS
I've edited the previous sample to implement the above settings too. Please find it attached.

If you have any further questions just let us know.

All the best,
Daniel
Attachments
sampleV2.zip
(6.04 KiB) Downloaded 343 times
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Binding check box value of registry entry to checkbox control

Hi Daniel,

Thanks for your reply.

I built and run the attached project(samplev2.zip), but the checkbox state is still showing as "unchecked" for the first time installation.
Do I need to make any further changes in the sample project.

Please suggest me.

Thanks
Raghu
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Binding check box value of registry entry to checkbox control

Hello Raghu,

Can you please run again a test on a clean machine?

No, you should not make any changes in the attached samplev2 projects. Just build and install them.

For testing purposes we always recommend to be used virtual machines with clean states so that when something goes wrong you can easily revert to a clean state of the virtual machine.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Binding check box value of registry entry to checkbox control

Hi Daniel,

I tested the sample project many times in different machines but, the checkbox state is still showing as unchecked while doing fresh install.

The problem here is the search property "CHECKBOX_1_PROP_EXISTS" is always returns true, even though there are no registries for the application exists in the machine.

The property [CHECKBOX_STATE] is set to empty value when there is no registry for the name - "CHECKBOX_1_PROP".

As [CHECKBOX_STATE] property becomes empty while loading the window, its value(empty or null) is assigned to CHECKBOX_1_PROP, as a result checkbox is in unchecked state.

Please help me how to check whether registry entry is exists in the machine.

Regards
Raghu
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Binding check box value of registry entry to checkbox control

Hello Raghu,

This is very very strange what you say. The "CHECKBOX_1_PROP_EXISTS" cannot return true as long as the searched registry value doesn't exist on the test machine. Can you please manually open the registry editor (regedit.exe) and make sure the following registry value

Code: Select all

HKLM\Software\Your Company\{F5CFB320-2AB5-4E4D-9D1A-6C8A167EF440}\CHECKBOX_1_PROP
is not already present on your test machine.

I've also tested the sampleV2 setups on a Windows 10 and on a Windows 8.1 machine and the checkbox is always checked by default at first time install.

Just to make sure you follow the same workflow, here is what you should do:
1. download the above attached "sampleV2.zip" and extract the AIPs (project files)
2. open the AIPs in Advanced Installer and just build them
3. launch the built setups

If the behavior still persists then please give me more details about your test machines, Windows version, architecture (x86 or x64), etc.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Binding check box value of registry entry to checkbox control

Hi,

I followed the same workflow as you said, But checkbox state is always unchecked.

My system configuration
1.OS: windows 10 Pro
2.64 bit operating system, X-64
3.AIP version- 13.3

Regards
Raghu
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Binding check box value of registry entry to checkbox control

Hello Raghu,

Indeed, the 13.3 version of Advanced Installer is the culprit here. My sample was created and tested with AI 13.2.2. Starting with AI 13.3 when the "registry value exists" extended search fails, inthis case its associated property "CHECKBOX_1_PROP_EXISTS" is set to "0" (therefore the condition added on the init event of "WelcomeDlg" is always true). It seems there was a change in what regards how our extended search behaves in AI 13.3. I apologize for this inconvenience.

Can you please open the sample AIPs (project files) in AI 13.3 and edit the control event, added in "Init Events" tab of "WelcomeDlg" dialog, to use a condition like this:

Code: Select all

CHECKBOX_1_PROP_EXISTS = "1"
rebuild the projects and test them again?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Binding check box value of registry entry to checkbox control

Hi Daniel,

Now it is working as expected. Thank you very much for your support.

Thanks
Raghu
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Binding check box value of registry entry to checkbox control

You're always welcome Raghu.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”