 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
José Guest
|
Posted: Mon Apr 24, 2006 9:03 am Post subject: A directory and TOpenDialog |
|
|
I have two problems.
Problem 1.
I want the user to select a directory (AKA folder), not a file. I can
do this with TOpenDialog. Actually this dialog serves to select a
file, but when I strip the last part from OpenDialog->FileName, the
directory remains.
I do not really like this method, since it confuses the user.
Furthermore it is impossible to select an empty directory.
Any solutions?
Problem 2.
The user runs my program and selects a directory with TOpenDialog. He
closes the program, reboots the computer and restarts the program.
When he starts TOpenDialog, I see that it has remembered the
directory, although I wrote no code to remember it.
OpenDialog->FileName is empty before TOpenDialog is started.
Where is this data stored?
Can I access this data without having the user start TOpenDialog?
--
José |
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Mon Apr 24, 2006 10:03 am Post subject: Re: A directory and TOpenDialog |
|
|
Hans Galema <notused (AT) notused (DOT) nl> wrote:
| Quote: | José wrote:
Where is this data stored?
Don't know.
|
Somewhere in the registry, would be my guess.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\...
looks suspicious.
Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Mon Apr 24, 2006 10:03 am Post subject: Re: A directory and TOpenDialog |
|
|
José wrote:
| Quote: | I want the user to select a directory (AKA folder), not a file.
|
Have a look at SelectDirectory() or SHBrowseForFolder().
| Quote: | When he starts TOpenDialog, I see that it has remembered the
directory, although I wrote no code to remember it.
OpenDialog->FileName is empty before TOpenDialog is started.
|
That is due to the OS. XP will do that. Win96SE not.
| Quote: | Where is this data stored?
|
Don't know.
Hans. |
|
| Back to top |
|
 |
José Guest
|
Posted: Mon Apr 24, 2006 1:03 pm Post subject: Re: A directory and TOpenDialog |
|
|
On Mon, 24 Apr 2006 10:59:23 +0200, Hans Galema <notused (AT) notused (DOT) nl>
wrote in borland.public.cppbuilder.nativeapi:
| Quote: | I want the user to select a directory (AKA folder), not a file.
Have a look at SelectDirectory() or SHBrowseForFolder().
|
Seems interesting, but SelectDirectory() has two versions, and they
say this, although the header in Filectrl.hpp is exact:
E2285 Could not find a match for
'SelectDirectory(AnsiString,WideString,AnsiString *)'.
E2285 Could not find a match for
'SelectDirectory(AnsiString *,TSelectDirOpt,int)'.
I cannot find SHBrowseForFolder() in the help file.
--
José |
|
| Back to top |
|
 |
Minas EnRethy Guest
|
Posted: Mon Apr 24, 2006 1:03 pm Post subject: Re: A directory and TOpenDialog |
|
|
? "Jose" <jose (AT) 127 (DOT) 0.0.1> wrote :
| Quote: | Problem 1.
I want the user to select a directory (AKA folder), not a file.
Any solutions?
|
Hi Jose,
1 . borland.public.cppbuilder.vcl.components.using
Date: Sun, 19 Feb 2006
Subject: TOpenDialog selecting directory
| Quote: | Problem 2.
When he starts TOpenDialog, I see that it has remembered the
directory, although I wrote no code to remember it.
|
2. You can use InitiaDir property of TOpenDialog or
set
ForceCurrentDirectory = true;
somewhere before call OpenDoalig->Execute()
if ForceCurrentDirectory is true, the dialog opens with the current working
directory displayed.
| Quote: |
Where is this data stored?
Can I access this data without having the user start TOpenDialog?
|
In registry as Alan wrote
_Minas
------
"Only virtue's conquests have certainty" Sofokleous Erephyle |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Mon Apr 24, 2006 2:03 pm Post subject: Re: A directory and TOpenDialog |
|
|
José wrote:
| Quote: | Seems interesting, but SelectDirectory() has two versions, and they
say this, although the header in Filectrl.hpp is exact:
E2285 Could not find a match for
'SelectDirectory(AnsiString,WideString,AnsiString *)'.
|
Please in such a case show your actual code so we can reproduce the
error.
Solution I think: Take all AnsiStrings.
| Quote: | E2285 Could not find a match for
'SelectDirectory(AnsiString *,TSelectDirOpt,int)'.
|
Ditto.
| Quote: | I cannot find SHBrowseForFolder() in the help file.
|
It is in win32.hlp.
Hans. |
|
| Back to top |
|
 |
Regis St-Gelais Guest
|
|
| Back to top |
|
 |
José Guest
|
Posted: Mon Apr 24, 2006 10:03 pm Post subject: Re: A directory and TOpenDialog |
|
|
On Mon, 24 Apr 2006 14:39:36 +0200, Hans Galema <notused (AT) notused (DOT) nl>
wrote in borland.public.cppbuilder.nativeapi:
| Quote: |
Seems interesting, but SelectDirectory() has two versions, and they
say this, although the header in Filectrl.hpp is exact:
E2285 Could not find a match for
'SelectDirectory(AnsiString,WideString,AnsiString *)'.
E2285 Could not find a match for
'SelectDirectory(AnsiString *,TSelectDirOpt,int)'.
Please in such a case show your actual code so we can reproduce the
error.
|
#include <filectrl.hpp>
String dir="";
WideString Root= "C:\\" ;
TSelectDirOpt opt=sdPrompt;
SelectDirectory((String)"Kies een map",Root,&dir);
SelectDirectory(&dir,opt,0);
| Quote: | I cannot find SHBrowseForFolder() in the help file.
It is in win32.hlp.
|
I haven't got that help file.
--
José |
|
| Back to top |
|
 |
Timothy H. Buchman Guest
|
Posted: Mon Apr 24, 2006 11:03 pm Post subject: Re: A directory and TOpenDialog |
|
|
| Quote: | closes the program, reboots the computer and restarts the program.
When he starts TOpenDialog, I see that it has remembered the
directory, although I wrote no code to remember it.
OpenDialog->FileName is empty before TOpenDialog is started.
|
Do be aware that this is related to Windows, and varies slightly with
the version of Windows in use. It is not a failing of TOpenDialog
itself, which merely wraps the API function.
--
Timothy H. Buchman
========================================
City Center Theater, New York NY
mail address tbuchmanPLEASE(at sign)REMOVEcitycenterD O Torg |
|
| Back to top |
|
 |
José Guest
|
Posted: Tue Apr 25, 2006 8:03 am Post subject: Re: A directory and TOpenDialog |
|
|
On Mon, 24 Apr 2006 17:26:00 -0400, "Regis St-Gelais"
<regis.st-gelais (AT) NOSPAMlaubrass (DOT) com> wrote in
borland.public.cppbuilder.nativeapi:
Hm, that one requires some careful examination. I'll see you again
next week.
--
José |
|
| Back to top |
|
 |
José Guest
|
Posted: Tue Apr 25, 2006 8:03 am Post subject: Re: A directory and TOpenDialog |
|
|
On Mon, 24 Apr 2006 14:38:10 +0300, "Minas EnRethy"
<(min_charATyahooPUTADOTgr)(HellenicFire)> wrote in
borland.public.cppbuilder.nativeapi:
| Quote: | Problem 2.
When he starts TOpenDialog, I see that it has remembered the
directory, although I wrote no code to remember it.
2. You can use InitiaDir property of TOpenDialog or
set
ForceCurrentDirectory = true;
somewhere before call OpenDoalig->Execute()
|
Unfortunately, the info is not in InitialDir. InitialDir is empty.
| Quote: | if ForceCurrentDirectory is true, the dialog opens with the current working
directory displayed.
|
So that's not what I want. It is fine that the original directory is
retained, but I want to know what it is before OpenDialog is executed.
| Quote: | Where is this data stored?
Can I access this data without having the user start TOpenDialog?
In registry as Alan wrote
|
A number of directories are mentioned there, but I do not know wich it
is. The Registry seems to have no relation between program and
directory, but merely between extension and directory.
--
José |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Apr 25, 2006 8:03 am Post subject: Re: A directory and TOpenDialog |
|
|
José wrote:
| Quote: | WideString Root= "C:\\" ;
|
You omitted my reply to use AnsiString only. Nor did you
comment on it. Did you try ?
| Quote: | It is in win32.hlp.
I haven't got that help file.
|
Isn't it somewere on a Borland update page ?
Hans. |
|
| Back to top |
|
 |
José Guest
|
Posted: Tue Apr 25, 2006 9:03 am Post subject: Re: A directory and TOpenDialog |
|
|
On Tue, 25 Apr 2006 09:22:29 +0200, Hans Galema <notused (AT) notused (DOT) nl>
wrote in borland.public.cppbuilder.nativeapi:
| Quote: | WideString Root= "C:\\" ;
You omitted my reply to use AnsiString only. Nor did you
comment on it. Did you try ?
|
E2285 Could not find a match for
'SelectDirectory(AnsiString,AnsiString,AnsiString *)'.
It doesn't surprise me. The header says that the second argument must
be WideString (whatever that may be)
--
José |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Apr 25, 2006 10:03 am Post subject: Re: A directory and TOpenDialog |
|
|
José wrote:
| Quote: | SelectDirectory((String)"Kies een map",Root,&dir);
SelectDirectory(&dir,opt,0);
|
SelectDirectory( "Kies een map", Root, dir);
SelectDirectory( dir,opt,0);
Hans. |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Apr 25, 2006 12:03 pm Post subject: Re: A directory and TOpenDialog |
|
|
José wrote:
Schaamrood is het mooiste rood.
Welcome to the club. We're not alone anymore.
Hans. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|