How do I set the text of an Edit control when a button is pressed?
The following article uses options that are available starting with the Enterprise edition and project type.
Changing or setting a text-field when a button is pressed is a frequent scenario when creating installers. In this article, you will learn how easily this can be done using Advanced Installer.
Store the new text
We will use a property to store the text value you want to use in your Edit Box.
- Go to Install Parameters.
- Press the "New Property" button from the top-bar.
- Create a public property (all letters must be uppercase); for example, we will name it MY_PROP.
Change the Edit Box text
We will use a Push Button with an event attached and an Edit Box to exemplify the scenario.
- Go to Dialogs.
- Using the Dialogs Toolbox, add an Edit Box which will have the default property name EDIT_1_PROP.
- Add a Push Button.
- Select the Push Button, and go to its Published Events tab.
- Press the New… button to add a new event.
- Select “Set Installer property value” from the Properties section of the event.
- Set “Property” to the name of the Edit Box property - EDIT_1_PROP.
- Set “Argument” to the name of the property the new text is stored - [MY_PROP].
Now, everytime a user presses the Push Button, the Edit Box’s text will be set to the value of the property created in Install Parameters.