KenCept
Posts: 1
Joined: Fri Sep 10, 2021 10:42 am

Dialogs - Radiobutton to control values in json

Fri Sep 10, 2021 10:51 am

Hi,

i got a jsonfile with an area of four values. is it possible to change 4 values with one Radiobutton in dialogs? or can i use something else in dialogs to achieve this?

radiobutton 1)

"area": {
"x": "10",
"y": "25",
"w": "55",
"h": "49"
}

radiobutton 2)

"area": {
"x": "15",
"y": "78",
"w": "80",
"h": "22"
}

Liviu
Posts: 139
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Dialogs - Radiobutton to controll values in json

Fri Sep 10, 2021 3:17 pm

Hi,

Yes, you can achieve this using RadioButton group and 2 .json files which will be installed conditionally based on the user selection. We need to add both files into the project, but only one file will be installed.

Basically, the steps you need to follow are these:

1. From the "Dialog" page, add the RadioButton group on the desired dialog.
dialog.jpg
dialog.jpg (84.72 KiB) Viewed 5077 times

2. Go to the "Registry" page and create a dummy registry, for example "UserSelection". We need this to condition the installation of the .json file based on the user selection.
reg.jpg
reg.jpg (25.71 KiB) Viewed 5077 times

3. In the "Files and Folders" page, add the .json file into the "Application Folder" using "New JSON File" option from the toolbar and configure it like this:
jsonButton1.jpg
jsonButton1.jpg (62.47 KiB) Viewed 5077 times
On the "Component" option select the "UserSelection" component which was created with the above dummy registry.

4. Since two files can not have the same name, we need to create another folder for the second .json file specific for the second Radio Button.
From the "Files and Folders" page, right click on the Application Folder → New Folder → Regular Folder.

5. Now, right click on the created folder → Properties and check the "Install folder content into the parent folder" option. This option is useful because we have more files with the same name that will be installed in the same folder based on the user selection.

6. In the newly created folder you can copy your .json file from the Application Folder. You need to change the values for "x, y, w, h" and from the "Component" option select the name of the folder you created, in my case "config". That .json file will be installed only when the user selects the second Radio Button.
jsonButton2.jpg
jsonButton2.jpg (78.4 KiB) Viewed 5077 times

7. The last step is to condition the .json files to be installed based on the user selection. From the "Organization" page:
  • Click on the "UserSelection" component and add the following condition: RADIOBUTTONGROUP_1_PROP = "RadioButton_1"
    componentJson1.jpg
    componentJson1.jpg (34.55 KiB) Viewed 5077 times
  • Click on the "config" component and add the following condition: RADIOBUTTONGROUP_1_PROP = "RadioButton_2"
    componentJson2.jpg
    componentJson2.jpg (31.54 KiB) Viewed 5077 times
In this way, the .json file from the "config" folder will be installed only when the user selects the second Radio Button and the .json file from the Application Folder when the first Radio Button is selected.

Now, if you test this, based on the user selection the specific values will be installed in the .json file.

You can find attached a sample project which implements these steps.

Hope this helps!

Best regards,
Liviu
Attachments
Demo App.aip
(19.79 KiB) Downloaded 119 times
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Sample Projects”