Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to select a directory via TOpenFile dialog?

732 views
Skip to first unread message

Iliya

unread,
Mar 18, 2008, 5:06:43 AM3/18/08
to
I'd like to let user to provide a way to select a directory using windows explorer style dialog in which a user would be able seeing all files, changing existing and creating new directories.
Thanks

Remy Lebeau (TeamB)

unread,
Mar 18, 2008, 5:30:29 AM3/18/08
to

"Iliya" <ili...@list.ru> wrote in message
news:47df...@newsgroups.borland.com...

> I'd like to let user to provide a way to select a directory using windows
> explorer style dialog

Use the VCL SelectDirectory() function or the Win32 API SHBrowseForFolder()
function for that.


Gambit


Iliya

unread,
Mar 18, 2008, 12:40:31 PM3/18/08
to
I'd like to let user to provide a way to select a directory using windows explorer style dialog in which a user would be able seeing all files, changing existing and creating new directories.
Thanks

> Use the VCL SelectDirectory() function or the Win32 API SHBrowseForFolder()
> function for that.
>
>
> Gambit
>
>

SelectDirectory doesn't fit since SHBrowseForFolder does not provide a way to manage folders (cannot create, cannot rename). See again my question above! I need it to be like OpenDialog to pick folder rather then file.

Remy Lebeau (TeamB)

unread,
Mar 18, 2008, 1:06:20 PM3/18/08
to

"Iliya" <ili...@list.ru> wrote in message
news:47df...@newsgroups.borland.com...

> I'd like to let user to provide a way to select a directory using


> windows explorer style dialog in which a user would be able
> seeing all files, changing existing and creating new directories.

You don't need to repeat yourself. You said that exact same thing in your
original message. SHBrowseForFolder() has the functionality you are asking
for.

> SHBrowseForFolder does not provide a way to manage folders

Yes, it does. Please read the documentation. It has BIF_BROWSEINCLUDEFILES
and BIF_NEWDIALOGSTYLE flags available for what you are asking.

> I need it to be like OpenDialog to pick folder rather then file.

SHBrowseForFolder() is the official folder selection dialog that Explorer
uses.


Gambit


Iliya

unread,
Mar 18, 2008, 1:39:48 PM3/18/08
to
>
> > SHBrowseForFolder does not provide a way to manage folders
>
> Yes, it does. Please read the documentation. It has BIF_BROWSEINCLUDEFILES
> and BIF_NEWDIALOGSTYLE flags available for what you are asking.
>
> > I need it to be like OpenDialog to pick folder rather then file.
>
> SHBrowseForFolder() is the official folder selection dialog that Explorer
> uses.
>
>
> Gambit

That is better but it still not the exact thing I need. It looks like a "tree view" thing. I need a standard file open/save folder look.

Philippe Bruno

unread,
Mar 18, 2008, 2:00:44 PM3/18/08
to
Iliya,

Well, since you really are looking for something like the standard open/save
file look, why don't you use the TOpenDialog component to allow the user to
select a file in the desired folder, and use ExtractFilePath() to only keep
the path information from that selection.

OpenDialog.FileName := 'Pick a folder';
if OpenDialog.Execute then
MyFolder := ExtractFilePath(OpenDialog.FileName);

It is not ideal, but I think this is a close to what you are trying to do as
one can get...

Philippe

"Iliya" <ili...@list.ru> wrote in message
news:47df...@newsgroups.borland.com...
>

Remy Lebeau (TeamB)

unread,
Mar 18, 2008, 3:19:22 PM3/18/08
to

"Iliya" <ili...@list.ru> wrote in message
news:47df...@newsgroups.borland.com...

> That is better but it still not the exact thing I need. It looks like a
> "tree view" thing.

That is what the standard dialog uses, yes.

> I need a standard file open/save folder look.

There is no such standard dialog for selecting and managing folders like
that. You will have to create your own.


Gambit


Jon Purvis

unread,
Mar 18, 2008, 3:34:12 PM3/18/08
to
Jon Purvis wrote:
> Michael Shkolnik is the man - this link has everything you'd need.
>
> http://www.scalabium.com/faq/dct0157.htm

To the original poster - you can ignore this, as it shows the tree view
you said you did not want in another post. I didn't have the newsgroup
threaded properly, so didn't see that message in time.

--
Jon Purvis
Wildlife Technical Programs Lead
Texas Parks and Wildlife Department
Austin, TX

Jon Purvis

unread,
Mar 18, 2008, 3:29:02 PM3/18/08
to

Michael Shkolnik is the man - this link has everything you'd need.

http://www.scalabium.com/faq/dct0157.htm


0 new messages