Kevin.lee
Posts: 3
Joined: Mon Jun 03, 2019 3:40 am

Populate Listbox with two Editbox

I would like to design an interface that allows users to add and remove IP addresses and Ports.
How can I present it on the listbox, or is there any other better way?

I hope we can finish assessment as soon as possible before the trial period expires, so if you have an instance, please provide it to us.

Regards,
Kevin
Last edited by Kevin.lee on Mon Jun 03, 2019 9:53 am, edited 1 time in total.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Populate Listbox with two Editbox

Hello Kevin and welcome to Advanced Installer forums,

First of all, thank you for your interest in Advanced Installer.

In what regards your request, indeed, you can use our support for ListBox/ComboBox controls. Please have a look on our "Working with Windows Installer ComboBox and ListBox" controls for more information about this.

As you have mentioned in your title, you can populate the ListBox using an Editbox (where your customers can add the IP addresses and the ports).

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kevin.lee
Posts: 3
Joined: Mon Jun 03, 2019 3:40 am

Re: Populate Listbox with two Editbox

Thank you for your reply.

I have tried the Scenario 3 example in the https://www.advancedinstaller.com/user- ... stbox.html page.
The problem is that after we add IP address, it can't populated or modified content in the Value item.

Regards,
Kevin
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Populate Listbox with two Editbox

Hello Kevin,

Please keep in mind that the listbox / combobox is not populated automatically. This has to be done through our predefined "PopulateListBox" custom action.

Please find below a sample project which I have created for you:
Kevin Sample - ListBox.aip
(15.99 KiB) Downloaded 173 times
and which I think you may find useful since it's pretty easy to see how it is configured.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kevin.lee
Posts: 3
Joined: Mon Jun 03, 2019 3:40 am

Re: Populate Listbox with two Editbox

Thank you very much

That I have new problem.
How to keep setting Server1, Server2, Server3 ...etc in the list, and when I remove Server2, that Server3 will become Server2.
And how can I use this list to bulid/edit XML file .
擷取.PNG
擷取.PNG (6.66 KiB) Viewed 2697 times


Sorry, I am asking you with such a simple question.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Populate Listbox with two Editbox

Hello Kevin,
How to keep setting Server1, Server2, Server3 ...etc in the list
This can be done in the following way: we will have a property which stores a number and we will increment that number (through a custom action) each time the user presses the "Add" button.

Here are the steps that are required in order to achieve that:

1. first of all, we will have to declare the property which will store our number. In order to do so, please go to "Install Parameters" page --> and create a property as it follows:

Name: NUMBER
Value: 0
Comment: leave empty


2. now that we have created the property, it is time to create the custom action that will take as input this property and increment its value every time the user presses the "Add" button. To do so, please proceed as it follows:

- go to "Custom Actions" page.

- add a "PowerShellScriptInline" custom action without sequence (by pressing the "Add custom action without sequence" button which is placed to the right side of the custom action's name).

- the custom action should look something as it follows:

Code: Select all

# Block for declaring the script parameters.
Param()

# Your code goes here.

# get the vlaue of the NUMBER property and stores it in $number_string variable
$number_string = AI_GetMsiProperty NUMBER

# converts the $number_string variable from string to integer so we can increment it
$number_int = [int]$number_string

# increments the variable
$number_int = $number_int + 1

# set the property to the new value of the variable
AI_SetMsiProperty NUMBER $number_int
3. now that the custom action is created, it is time to schedule it when the "Add" button is pressed. To do so, please proceed as it follows:

- go to "Dialogs" page

- select the dialog that contains the listbox / combobox control

- select the "Add" button

- go to "Published Events" tab and create a new published event as it follows:

Event: Execute Custom Action
Argument: the PowerShell script we have earlier created
Condition: leave empty


- place this at the top of your events list by selecting it and pressing the "Up" button (until it reaches the top)

Attached below you can find another sample project which is based on the first sample project I have given you:
Kevin Sample - ListBox + increment.aip
(17.35 KiB) Downloaded 161 times
and when I remove Server2, that Server3 will become Server2.
I am afraid that this is not possible - or at least I can not think of any way in which you can achieve it.
And how can I use this list to bulid/edit XML file .
Here it depends what you want to do. This can also be achieved through a custom action.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”