How to update a text box from a browse button in the dialog editor

Got a problem you cannot solve? Try here.
khalprin
Posts: 47
Joined: Fri Aug 25, 2006 2:02 pm

How to update a text box from a browse button in the dialog editor

Postby khalprin » Wed Oct 02, 2024 4:43 pm

I've tried to search for this, but I always get hundreds of unrelated results.

My installer (using X16) has a dialog with a path for the target directory and a button to browse. Browsing and selecting a folder updates the text box. (normal stuff)

I want to add a second text box and a second browse button to select another path. I've got the text box added and the new button will browse - but I don't see a way to make the result of the second browse button update the second text box.

How is that done?

JohnGaver
Posts: 115
Joined: Mon Feb 05, 2024 6:15 pm

Re: How to update a text box from a browse button in the dialog editor

Postby JohnGaver » Fri Oct 04, 2024 5:54 pm

This topic applies to InstallAware Multi Platform as well.

That's a great question.

I've attached a sample InstallAware Multi Platform dialog (and its rules file) that I built for you.

So let's say you have two edit boxes, Edit1 and Edit2, and two buttons, Button1 and Button2 - as in my attached sample.

Pull up the Define Interactive Characteristics dialog from the View | Object Behavior menu.

From the Control drop-down, select each button and set its Performs Action field to Select Custom Folder.

Then, from the same drop-down menu, select each edit box, set its Receives Information field to [Written Variable Value], and in its Writes Values to Variable field, type in the name of the button to associate with the edit box (ex: type BUTTON1 for Edit1, etc.)

multiples.png
multiples.png (223.88 KiB) Viewed 42 times

In your script, define the BUTTON1 variable using the Set Variable command (assigning it to its default value) before showing your dialog; and just dereference that variable normally typing $BUTTON1$ in any command you need it.

You can use this same trick to capture any custom data inside edit boxes, BTW - you don't have to assign buttons to edit boxes; they can still be associated with variables and update them normally, any time.

The buttons here are just helping to automatically bring up a Browse for Folder dialog when they are clicked, you could achieve the same effect manually using scripting (via the Browse for Folder command) and the Return from Dialog button action under Object Behavior - just as an example.

The Game Porting Toolkit Installer sample included with InstallAware Multi Platform (and also available at https://github.com/installaware/AGPT) showcases how to handle dialog events like this - hope that helps!
Attachments
multiples.zip
(1.39 KiB) Downloaded 8 times
John Gaver
InstallAware Skunkworks
InstallAware Multi Platform - Liberating DEB/RPM/PKG/MSI(X) into universal native setups!
Get your free copy today - https://www.installaware.com/installaware-multi-platform.htm


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 21 guests