Depending on a selection made in a radiogroup i like to browse (with the same button) for a directory or a file.
I searched the forum but didn't found any hint how to pass the neccesary variables to the "FileBrowse=" function.
Also I didn't found a way to pass the initialdir as a variable to this function.
Would be nice if anybody knows a solution.
Browsing for a dir or a file depending on selected option
Moderators: JRL, Dorian (MJT support)
If you mean that you can't get filebrowse initialdir to work when the "dir" option is selected. That's been an issue for a while. I first noticed it a year ago, then forgot about it.Also I didn't found a way to pass the initialdir as a variable to this function.
I don't think there is a way to cause the filebrowse definition to change mid-script. What you could easily do is create two separate filebrowse buttons and put them in the same location in the dialog. Then use the radio button selection to turn one off and the other on using the SetDialogObjectVisible> function.Depending on a selection made in a radiogroup i like to browse (with the same button) for a directory or a file.
Code: Select all
Dialog>Dialog1
Caption=Dialog1
Width=459
Height=250
Top=CENTER
Left=CENTER
Button=Directory,358,31,75,25,0
Button=File,358,31,75,25,0
Edit=msEdit1,14,34,331,
RadioGroup=msRadioGroup1,Browse Type,352,69,81,44,Directory%CRLF%File,0
Button=OK,172,174,75,25,3
FileBrowse=Directory,msEdit1,All Files|*.*,dir
FileBrowse=File,msEdit1,All Files|*.*,open
EndDialog>Dialog1
Show>dialog1
Label>Loop
GetDialogAction>Dialog1,res1
If>res1=2
Exit>0
EndIf
If>DIALOG1.MSRADIOGROUP1.ITEMINDEX=0
SetDialogObjectVisible>Dialog1,msButton1,1
SetDialogObjectVisible>Dialog1,msButton2,0
Else
SetDialogObjectVisible>Dialog1,msButton1,0
SetDialogObjectVisible>Dialog1,msButton2,1
EndIf
Wait>0.01
Goto>Loop
Thanks JRL,
it works well when I do it like this:
Otherwise I can not use the FileBrowse-open to get only *.mdf files.
it works well when I do it like this:
Code: Select all
FileBrowse=%str111%,strDBFilePath1,DIR|*.mdf,dir
FileBrowse=%str110%,strDBFilePath1,mdf|*.mdf,open,C:\
regards
migro
migro