Board index » delphi » Directory Select Dialog Box?

Directory Select Dialog Box?

I am writing a Delphi 2.0 program that in its setup form needs to
allow the user to select a directory for their image files.  I store
this as a registry entry and from then on the user doesn't have to
mess with it unless they want to change.

I would like to use a common dialog box for this.  Right now I'm
using a file/open dialog.  This works well, but it forces the user
to select a file in the directory in order to tell me the directory.
This is not normal behavior.

Is there a "correct" way to implement a directory/open (select) dialog
using common dialog boxes?

I'd really appreciate an email on this if you have a good answer.  
I'll try to scan the newsgroup as I've been doing all along, but
there's a lot of it.  mailto://marti...@sprynet.com

Thanks.

 

Re:Directory Select Dialog Box?


Quote
Michael K. Martin wrote:

I'm replying to my own message to publicly thank David Lederman for
pointing out the SelectDirectory function for me.  It solved my problem
perfectly.
Quote
> I am writing a Delphi 2.0 program that in its setup form needs to
> allow the user to select a directory for their image files.  I store
> this as a registry entry and from then on the user doesn't have to
> mess with it unless they want to change.

> I would like to use a common dialog box for this.  Right now I'm
> using a file/open dialog.  This works well, but it forces the user
> to select a file in the directory in order to tell me the directory.
> This is not normal behavior.

> Is there a "correct" way to implement a directory/open (select) dialog
> using common dialog boxes?

> I'd really appreciate an email on this if you have a good answer.
> I'll try to scan the newsgroup as I've been doing all along, but
> there's a lot of it.  mailto://marti...@sprynet.com

> Thanks.

Re:Directory Select Dialog Box?


"Michael K. Martin" <marti...@sprynet.com> wrote:

Quote
>I'm replying to my own message to publicly thank David Lederman for
>pointing out the SelectDirectory function for me.  It solved my problem
>perfectly.

Well, not if you want to use a common dialog as you said earlier.  The
SelectDirectory is just a form that is common to Delphi, not to the system.
Win16 doesn't have a common dialog for directory selection, but Win32 does.
SHBrowseForFolder is the API, but it requires a lot of setup to use it.  I
have written a component wrapper for it (freeware w/ source).  If you want
to have a look at it, you can find it on my web site (URL in sig), look for
TBrowseDirectory.

Regards,
Brad
Free Delphi Stuff:  http://www.pobox.com/~bstowers/delphi/
bstow...@pobox.com (My return address is intentionally invalid; delete ".Remove-This-Spam-Blocker" for real address)

Re:Directory Select Dialog Box?


On Tue, 15 Apr 1997 20:45:36 -0500, "Michael K. Martin"

Quote
<marti...@sprynet.com> wrote:
>I am writing a Delphi 2.0 program that in its setup form needs to
>allow the user to select a directory for their image files.  I store
>this as a registry entry and from then on the user doesn't have to
>mess with it unless they want to change.

>I would like to use a common dialog box for this.  Right now I'm
>using a file/open dialog.  This works well, but it forces the user
>to select a file in the directory in order to tell me the directory.
>This is not normal behavior.

>Is there a "correct" way to implement a directory/open (select) dialog
>using common dialog boxes?

>I'd really appreciate an email on this if you have a good answer.  
>I'll try to scan the newsgroup as I've been doing all along, but
>there's a lot of it.  mailto://marti...@sprynet.com

>Thanks.

Use a  TDirectoryListBox and your problem will be solved. Place this
control on a new form and either create it or show it, as required.

Re:Directory Select Dialog Box?


Quote
> Is there a "correct" way to implement a directory/open (select) dialog
> using common dialog boxes?

FBrowse.pas
------------------------------------------
by Pablo pissanetzky
http://www.neosoft.com/~pablo
------------------------------------------

TFolderBrowse is a component for Windows 95 only!
It opens the familiar tree view control used in Explorer
and allows the user to select a folder. It encapsulates the
Windows 95 function SHBrowseForFolder.

That should do it.

        Dave

Re:Directory Select Dialog Box?


Quote
>I would like to use a common dialog box for this.  Right now I'm
>using a file/open dialog.  This works well, but it forces the user
>to select a file in the directory in order to tell me the directory.
>This is not normal behavior.

So would I...<sigh> All I could figure out was to use a re-titled
*save* dialog (!!) and pass a bogus filename to it prior to execution.
It allows selecting a dir, as  long as you strip the filename from the
result, but you need to be careful about how you name the bogus file.

Not perfect, but saves you 50k of filectrl overhead when you  need it.

-Cub-

Re:Directory Select Dialog Box?


Hello marti...@sprynet.com!

Wednesday April 16 1997, "Michael K. Martin" wrote to All:

 MKM> I would like to use a common dialog box for this.  Right now I'm
 MKM> using a file/open dialog.  This works well, but it forces the user
 MKM> to select a file in the directory in order to tell me the directory.
 MKM> This is not normal behavior.

Why not use TDirectorylistBox??

Kind regards Ole

    E-Mail: Ole_Morten...@Hotmail.com

Re:Directory Select Dialog Box?


Ole Almind Mortensen <Ole.Almind.Morten...@p150.f10.n237.z2.fidonet.org>
escribi en artculo <37b_9704252...@night.ping.dk>...

Quote
> Wednesday April 16 1997, "Michael K. Martin" wrote to All:
>  MKM> I would like to use a common dialog box for this.  
>  MKM> ...This works well, but it forces the user
>  MKM> to select a file in the directory to tell me the directory.
>  MKM> This is not normal behavior.

> Why not use TDirectorylistBox??

And Why not use 'SELECTDIRECTORY' function?

This show a message box for a directory selection!!!!

And create a directory if you like !!!

Other Threads