How to assign an initial folder to a browse button in a dialog

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

How to assign an initial folder to a browse button in a dialog

Postby khalprin » Thu Jan 30, 2025 5:21 pm

Hello,

I'm using X16 and have a dialog with a few textbox / browse-button pairs. Those work correctly to browse to a folder, select it, and update the text box (thanks for all the help on this question: viewtopic.php?f=2&t=11617&hilit=browse+button).

I realized that I wasn't assigning a starting browse location, and now can't figure out if that's possible. I'd like to use the folder path that's initially shown in the text box before a browse has been done as the starting folder location that's shown when the browse button is clicked.

Is that possible?

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

Re: How to assign an initial folder to a browse button in a dialog

Postby JohnGaver » Fri Jan 31, 2025 7:02 am

This topic applies to InstallAware Multi Platform as well.

Like in the post you linked, this too is a great question.

Both of the Browse for File and Browse for Folder commands have fields to support initial startup locations.

These fields are named Default Directory and Root Directory, respectively.
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

khalprin
Posts: 51
Joined: Fri Aug 25, 2006 2:02 pm

Re: How to assign an initial folder to a browse button in a dialog

Postby khalprin » Fri Jan 31, 2025 9:22 am

Thanks for the response JohnGaver -

But I'm referring to a button on a dialog form instead of the script commands 'Browse for File' and 'Browse for Folder'. The 'Object Behavior' window lets me choose 'Select Custom Folder' as the action to perform when a user clicks the button, but I don't see way to assign a folder that is shown when the browser window first opens after clicking the button.

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

Re: How to assign an initial folder to a browse button in a dialog

Postby JohnGaver » Fri Jan 31, 2025 11:41 am

Got it, in that scenario it may help to initialize the variables the buttons are bound to with the default values you desire.

Please note that as an alternative approach, you may always use the Return from Dialog action for your buttons and then invoke the script commands I've named above. Just show the dialog again when you're done handling all button actions in your script.

A good example of how to handle dialog events like this is found in InstallAware Multi Platform's Game Porting Toolkit Installer sample.
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

khalprin
Posts: 51
Joined: Fri Aug 25, 2006 2:02 pm

Re: How to assign an initial folder to a browse button in a dialog

Postby khalprin » Fri Jan 31, 2025 11:46 am

Hmmm, the variables are initialized correctly. I can see the initial folder in the text box linked to the button. But the button opens a browse dialog with a different folder (which is not consistent across multiple tests).

I will take a look at the Game Porting Toolkit Installer sample too.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 111 guests