PDA

View Full Version : Folder Browse Dialog Question


NitLions
03-26-2007, 02:36 PM
I just added the Folder Browse dialog so that a user can pick a destination folder for a third party application, which will be passed into a command line. All seems to work fine, but I have a question...

Is there any way to disable the Make New Folder and Cancel buttons? Also, would there be any way to change the displayed dialog title? Currently, it simply displays as 'Browse for Folder'.

Any help appreciated!

Thanks!

NitLions
03-26-2007, 03:15 PM
Can I do something with the butons with code? I saw something in another post similar to this...

if avdir == "CANCEL" then
do something and maybe end the application
else
possibly display message of selected location for verification
end

NitLions
03-26-2007, 03:19 PM
Also, how can I loop, if possible at all, until selected destination is verified as OK. For example if they enter a path and they indicate this is not correct, how can I loop to display the folder browse dialog again?

Same for if Cancel is selected - how can I loop back to the browse dialog if the user indicates they do not truly wish to cancel?

Tek
03-26-2007, 03:40 PM
Also, how can I loop, if possible at all, until selected destination is verified as OK. For example if they enter a path and they indicate this is not correct, how can I loop to display the folder browse dialog again?

Same for if Cancel is selected - how can I loop back to the browse dialog if the user indicates they do not truly wish to cancel?

Here is some code I put together to do just that. I put this code on my 'Browse' button.


bCSelected = 1;
while bCSelected == 1 do
sBackupFolder = Dialog.FolderBrowse("Please select a backup folder:", _DesktopFolder);
if sBackupFolder ~= "CANCEL" then
sDriveLetter = String.Left(sBackupFolder, 2);
if sDriveLetter ~= "C:" then
Input.SetText("O_InputFolder", sBackupFolder);
bCSelected = 0;
else
Dialog.Message("Invalid Configuration", "You cannot select the source drive as the backup drive.\r\n\nPlease select another location.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
bCSelected = 1;
end
else
bCSelected = 0;
end
end


You can make some simple modifications here to disallow the CANCEL button as well.

NitLions
03-27-2007, 07:43 AM
If I present a Yes No dialog to confirm cancel and or confirm selected destination location, what condition do I use?

If result == "YES" or "NO" ?

Worm
03-27-2007, 08:15 AM
if result == IDYES

or

if result == IDNO

NitLions
03-27-2007, 12:33 PM
I looked in the help for the dialog 'stuff' and found that I could use If result == 6 for yes. That should work, right?

Worm
03-27-2007, 12:35 PM
Yep, using the IDYES/IDNO is just a little more visual when you're reading through your code. A little easier to see what you are checking for is all.

Tek
03-27-2007, 12:36 PM
I looked in the help for the dialog 'stuff' and found that I could use If result == 6 for yes. That should work, right?

Yep that will work as well.

NitLions
03-28-2007, 08:56 AM
Ah, got it!

Thanks All!!