dako
Posts: 4
Joined: Tue Aug 08, 2006 2:05 pm

File Selection Box

i need the possibility to select files in the dialog section (files outside the msi package) and save the selected file into a property.
I need also basic file operations (e.g. rename) with the selected file.

thanx.
dani
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

I'm afraid i don't really understand what you are trying to say with "the possibility to select files in the dialog section". Please give me more details.

Regards,
Gigi
__________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
dako
Posts: 4
Joined: Tue Aug 08, 2006 2:05 pm

Hi

i try to explain:
In the User/Dialog Section you can choose the <installation path> with the Dialog "FolderDlg"/"BrowseDlg".
I would like to have a similar dialog () where i can choose a file (not only the path) and get info (e.g. last access date) of it.
In the toolbox there is a "directory list" but no "file list".

Regards,
Dani
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,
In the toolbox there is a "directory list" but no "file list".
Advanced Installer does not support this type of control because windows installed does not support it. All supported controls resides on the toolbox.

But please give me more details about what you are trying to achieve. Maybe there is another way of doing it.

Regards,
Gigi
________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
dako
Posts: 4
Joined: Tue Aug 08, 2006 2:05 pm

Hi,
i have a update file from the existing older installation where all the user data is stored (and finally transfered in the new version).
The name of this file is not always the same (like v_*.dat).

Other solution:
-1- i have to collect all the files like v_*.dat
-2- the user chooses one
-3- i rename the file to the fixed new name

how can i achieve this?

thanx.
Dani
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Here is how you can browse for a file:

1. Create under your dialog an edit and a button control. Select the edit control and set a property for it like this: MY_FILEPATH.
2. Create a .vbs file with the following code:

Code: Select all

Function fBrowseForFile()
    sBrowsePath = "C:\"
    sBrowseFilter = "All Files|*.*"
    Set oBrowseDialog = CreateObject("UserAccounts.CommonDialog")
    oBrowseDialog.Filter = sBrowseFilter
    oBrowseDialog.InitialDir = sBrowsePath
    oBrowseDialog.Flags = &H80000 + &H4 + &H8
    oBrowseDialog.ShowOpen
    fBrowseForFile = oBrowseDialog.FileName
End Function

strFileName = fBrowseForFile

if(strFileName <> "") then
    Session.Property("MY_FILEPATH") = strFileName
end if
3. Switch to "Custom Actions" page and create a "New Attached Custom Action" under the "UI Custom Actions" section. Select the .vbs file created at step 2. The "Function Name" field must be empty.
4. Switch back to the "Dialogs" page and select the button control. Now add two published events like this:
a) Name: DoAction, Argument: select the custom action added at step 3.
b) Name: SetProperty (after you select from combo change the "SetProperty" text with [MY_FILEPATH]), Argument: [MY_FILEPATH]

Hope this help.

Regards,
Gigi
________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
dako
Posts: 4
Joined: Tue Aug 08, 2006 2:05 pm

Hi
perfect. thanx.
Dani
mtande
Posts: 8
Joined: Fri Feb 02, 2007 1:12 pm
Contact: Website

Hmmm. I tried this, and it *soft of* works. However, when returning from the file selection box I would expect the name of the selected file to appear in my edit control -- but it doesn't. The edit control sits there still empty.

The name of the file I selected is available, though. It's just not visible immediately. If I do Next> followed by <Back the file name pops up.

I'm sure I do something wrong here... Any help?

-mats
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Mats,

Most likely you have not configured the "SetProperty" Control Event correctly. Make sure that this event comes after the "DoAction" event and that both the "Event" and "Argument" fields are set to the value of the Property that holds the file path ([MY_FILEPATH] in the example).
b) Name: SetProperty (after you select from combo change the "SetProperty" text with [MY_FILEPATH]), Argument: [MY_FILEPATH]
Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
mtande
Posts: 8
Joined: Fri Feb 02, 2007 1:12 pm
Contact: Website

Ionut,

> Both the "Event" and "Argument" fields are set to the value
> of the Property that holds the file path

ahhh... there it was, the small but vital detail I mis-interpreted. Now it works -- thanks!

-mats
mtande
Posts: 8
Joined: Fri Feb 02, 2007 1:12 pm
Contact: Website

I have two questions about this:
Create under your dialog an edit and a button control. Select the edit control and set a property for it like this: MY_FILEPATH
Q1: I have created this custom dialog and everything* works fine. However, the edit control does not have focus when the dialog is displayed, which means that my users need to click with the mouse into the box or do a number of tabs.

How do I specify that a given input field shall have the focus?

Q2: On Vista, the installer crashes when I click the "Browse" button. However, if I press the Browse button in the CustomSetup, browsing works. So it looks like there's something wrong with my custom dialog.

How do I make the Browse button work on Vista?

-mats

Custom dialog details

"grep LicenseFileCheck myproject.aip" (LicenseFileCheck is the name of my dialog) returns the following:

Code: Select all

    <ROW Dialog_="LicenseFileDialog" Control="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Back]" Control_Next="BannerBitmap" TextLocId="-"/>
    <ROW Dialog_="LicenseFileDialog" Control="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Attributes="1" Text="[BannerBitmap]" Control_Next="BannerLine"/>
    <ROW Dialog_="LicenseFileDialog" Control="BannerLine" Type="Line" X="0" Y="44" Width="372" Height="0" Attributes="1" Control_Next="BottomLine"/>
    <ROW Dialog_="LicenseFileDialog" Control="BottomLine" Type="Line" X="5" Y="234" Width="368" Height="0" Attributes="1" Control_Next="Description"/>
    <ROW Dialog_="LicenseFileDialog" Control="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Cancel]" Control_Next="Back" TextLocId="-"/>
    <ROW Dialog_="LicenseFileDialog" Control="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Attributes="196611" Text="Supply the license file" Control_Next="Title" TextLocId="Control.Text.TemplateDlg#Description"/>
    <ROW Dialog_="LicenseFileDialog" Control="Logo" Type="Text" X="4" Y="228" Width="88" Height="12" Attributes="1" Text="G&&R Software Installer" Control_Next="LicenseFileDialogBrowseButton" TextLocId="Control.Text.TemplateDlg#Logo"/>
    <ROW Dialog_="LicenseFileDialog" Control="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Attributes="3" Text="[ButtonText_Next]" Control_Next="Cancel" TextLocId="-"/>
    <ROW Dialog_="LicenseFileDialog" Control="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Attributes="196611" Text="Install license" TextStyle="[DlgTitleFont]" Control_Next="FolderLabel" TextLocId="Control.Text.TemplateDlg#Title"/>
    <ROW Dialog_="LicenseFileDialog" Control="FolderLabel" Type="Text" X="21" Y="120" Width="348" Height="12" Attributes="3" Text="&License file:" Control_Next="Text" Help="|" TextLocId="Control.Text.FolderDlg#FolderLabel" HelpLocId="Control.Help.FolderDlg#FolderLabel"/>
    <ROW Dialog_="LicenseFileDialog" Control="Text" Type="Text" X="22" Y="71" Width="320" Height="49" Attributes="3" Text="Select the file which contains the license information. The file should be supplied by your software distributor. Note that [ProductName] [Setup] cannot continue without valid license information." Control_Next="LicenseFileDialogText_348" TextLocId="Control.Text.FolderDlg#Text"/>
    <ROW Dialog_="LicenseFileDialog" Control="LicenseFileDialogBrowseButton" Type="PushButton" X="274" Y="132" Width="56" Height="17" Attributes="3" Text="Br&owse" Control_Next="Next"/>
    <ROW Dialog_="LicenseFileDialog" Control="LicenseFileDialogText_348" Type="Text" X="25" Y="174" Width="243" Height="49" Attributes="65539" Text="[GAR_LICENSE_FILE_STATUS]" Control_Next="LicenseFileDialogEdit_346"/>
    <ROW Dialog_="LicenseFileDialog" Control="LicenseFileDialogEdit_346" Type="Edit" X="22" Y="132" Width="246" Height="17" Attributes="3" Property="GAR_LICENSEFILEPATH" Control_Next="Logo" Help="|"/>
    <ROW Dialog_="SetupTypeDlg" Control_="Back" Event="NewDialog" Argument="LicenseFileDialog" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="PlatformDialog" Control_="Next" Event="NewDialog" Argument="LicenseFileDialog" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="LicenseFileDialog" Control_="Cancel" Event="SpawnDialog" Argument="CancelDlg" Condition="1" Ordering="1"/>
    <ROW Dialog_="LicenseFileDialog" Control_="Back" Event="NewDialog" Argument="PlatformDialog" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="LicenseFileDialog" Control_="Next" Event="NewDialog" Argument="SetupTypeDlg" Condition="AI_INSTALL AND GAR_VALIDATED_LICENSE_FILE="TRUE"" Ordering="2"/>
    <ROW Dialog_="LicenseFileDialog" Control_="LicenseFileDialogBrowseButton" Event="DoAction" Argument="PickupLicenseFileFromDisk" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="LicenseFileDialog" Control_="LicenseFileDialogBrowseButton" Event="[GAR_LICENSEFILEPATH]" Argument="[GAR_LICENSEFILEPATH]" Condition="AI_INSTALL" Ordering="2"/>
    <ROW Dialog_="LicenseFileDialog" Control_="Next" Event="DoAction" Argument="ValidateLicenseFile" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog="LicenseFileDialog" HCentering="50" VCentering="50" Width="370" Height="270" Attributes="3" Title="[ProductName] [Setup]" Control_First="Next" Control_Default="Next" Control_Cancel="Cancel"/>
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

1. The focus is given to the first control in tab order. So if you want that "EditBox" to have the focus put in first in tab order.

2. Yes, it seams that "UserAccounts.CommonDialog" object does not exist on Windows Vista. Other approach is to use a DLL custom action with "CFileDialog" class. For a DLL custom action example please see:
http://www.advancedinstaller.com/user-g ... n-dll.html

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
danliang
Posts: 8
Joined: Thu Dec 28, 2006 7:31 pm

Dialog Positioning

Is there a parameter or some other way to make the dialog modal to the installer and to specify the positioning of the dialog on the screen?
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

If you use a C++ DLL custom action you can use GetForegroundWindow function to get the parent window handle and send it when you create the browse window:
http://msdn.microsoft.com/library/defau ... window.asp

However we plan to introduce this feature (browse for file) on the next version of Advanced Installer.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Phobos
Posts: 85
Joined: Fri Sep 08, 2006 11:52 am
Location: Germany

Hi,

I need to add a Browse File dialog to my project and followed the instructions mentioned in this thread. On my Windows XP machine this works fine, but the Browse File dialog does not get the focus. Is there an easy way to fix this?

On my Windows Server 2003 machine the browse button does not work, as soon as I click the button I get the the message "Your Application setup ended prematurely because of an error". What is causing this?

Gigi mentioned in his last post that there are plans to introduce a Browse File dialog in the next AI version, has this already been implemented?

Thanks.

Return to “Feature Requests”