Board index » cppbuilder » an open dialog for directory

an open dialog for directory


2004-05-10 12:25:07 PM
cppbuilder32
Hi folks,
I'm new to C++Buider and VCL, and I have a very basic question on
TOpenDialog usage. Can I customize it to select a directory instead of a
file or files? I wonder if the Filter property will be helpful.
Thanks.
 
 

Re:an open dialog for directory

Quote
I'm new to C++Buider and VCL, and I have a very basic question on
TOpenDialog usage. Can I customize it to select a directory instead of a
file or files? I wonder if the Filter property will be helpful.
This has been discussed many times before.
There are two ways:
1) VCL solution: SelectDirectory()
2) API solution: SHBrowseForFolder()
Please refer VCL help for (1) and Win32API Help for (2).
If you use SelectDirectory() than depending on parameters
the dialog can look like:
* classic Windows style
* special
If you use SHBrowseForFolder() and you have BCB5 or BCB6
installed you need to modify Project /Options. Under
Directories/Conditionals you are supposed to add
NO_WIN32_LEAN_AND_MEAN. Otherwise you'll get many
strange compiler errors.
Best regards,
Vladimir Stefanovic
 

Re:an open dialog for directory

Thank you for the info. I'll check old postings first next time.
Which header files should I include if I use SelectDirectory? I tried
qdialogs.hpp but get "Ambiguity between 'TForm' and 'Forms::TForm' error in
one of my other files.
Thanks.
"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
>I'm new to C++Buider and VCL, and I have a very basic question on
>TOpenDialog usage. Can I customize it to select a directory instead of a
>file or files? I wonder if the Filter property will be helpful.

This has been discussed many times before.

There are two ways:
1) VCL solution: SelectDirectory()
2) API solution: SHBrowseForFolder()

Please refer VCL help for (1) and Win32API Help for (2).

If you use SelectDirectory() than depending on parameters
the dialog can look like:
* classic Windows style
* special

If you use SHBrowseForFolder() and you have BCB5 or BCB6
installed you need to modify Project /Options. Under
Directories/Conditionals you are supposed to add
NO_WIN32_LEAN_AND_MEAN. Otherwise you'll get many
strange compiler errors.

Best regards,
Vladimir Stefanovic





 

{smallsort}

Re:an open dialog for directory

Quote
Which header files should I include if I use
SelectDirectory? I tried qdialogs.hpp but get
"Ambiguity between 'TForm' and 'Forms::TForm' error in
one of my other files.
I'm not currently writing this post on the machine with BCB
installed to check. Just find SelectDirectory in BCB Help.
As I can remember there is an example with all the necessary
includes listed.
Best regards,
Vladimir Stefanovic
 

Re:an open dialog for directory

"fang lu" < XXXX@XXXXX.COM >wrote in message
Quote
Which header files should I include if I use SelectDirectory?
FileCtrl.hpp
Quote
I tried qdialogs.hpp but get "Ambiguity between
'TForm' and 'Forms::TForm' error in one of my other files.
qdialogs.hpp is a CLX header file. Unless you are making a CLX project, you
should not be mixing CLX and VCL headers together.
Gambit
 

Re:an open dialog for directory

Thank you all! It works now.
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"fang lu" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>Which header files should I include if I use SelectDirectory?

FileCtrl.hpp

>I tried qdialogs.hpp but get "Ambiguity between
>'TForm' and 'Forms::TForm' error in one of my other files.

qdialogs.hpp is a CLX header file. Unless you are making a CLX project,
you
should not be mixing CLX and VCL headers together.


Gambit