Thread View: borland.public.cppbuilder.nativeapi
17 messages
17 total messages
Started by Jos�
Mon, 24 Apr 2006 08:39
A directory and TOpenDialog
Author: Jos�
Date: Mon, 24 Apr 2006 08:39
Date: Mon, 24 Apr 2006 08:39
22 lines
1570 bytes
1570 bytes
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�
Re: A directory and TOpenDialog
Author: Hans Galema
Date: Mon, 24 Apr 2006 08:59
Date: Mon, 24 Apr 2006 08:59
17 lines
1421 bytes
1421 bytes
Jos� wrote: > I want the user to select a directory (AKA folder), not a file. Have a look at SelectDirectory() or SHBrowseForFolder(). > 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. > Where is this data stored? Don't know. Hans.
Re: A directory and TOpenDialog
Author: Alan Bellingham
Date: Mon, 24 Apr 2006 09:33
Date: Mon, 24 Apr 2006 09:33
16 lines
1441 bytes
1441 bytes
Hans Galema <notused@notused.nl> wrote: >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
Re: A directory and TOpenDialog
Author: Minas EnRethy
Date: Mon, 24 Apr 2006 11:38
Date: Mon, 24 Apr 2006 11:38
35 lines
1931 bytes
1931 bytes
? "Jose" <jose@127.0.0.1> wrote : > 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 > 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. > > 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
Re: A directory and TOpenDialog
Author: Jos�
Date: Mon, 24 Apr 2006 11:55
Date: Mon, 24 Apr 2006 11:55
19 lines
1629 bytes
1629 bytes
On Mon, 24 Apr 2006 10:59:23 +0200, Hans Galema <notused@notused.nl> wrote in borland.public.cppbuilder.nativeapi: >> 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�
Re: A directory and TOpenDialog
Author: Hans Galema
Date: Mon, 24 Apr 2006 12:39
Date: Mon, 24 Apr 2006 12:39
23 lines
1636 bytes
1636 bytes
Jos� wrote: > 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. > E2285 Could not find a match for > 'SelectDirectory(AnsiString *,TSelectDirOpt,int)'. Ditto. > I cannot find SHBrowseForFolder() in the help file. It is in win32.hlp. Hans.
Re: A directory and TOpenDialog
Author: Jos�
Date: Mon, 24 Apr 2006 20:41
Date: Mon, 24 Apr 2006 20:41
29 lines
1820 bytes
1820 bytes
On Mon, 24 Apr 2006 14:39:36 +0200, Hans Galema <notused@notused.nl> wrote in borland.public.cppbuilder.nativeapi: > >> 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); >> I cannot find SHBrowseForFolder() in the help file. > >It is in win32.hlp. I haven't got that help file. -- Jos�
Re: A directory and TOpenDialog
Author: Regis St-Gelais
Date: Mon, 24 Apr 2006 21:26
Date: Mon, 24 Apr 2006 21:26
15 lines
1591 bytes
1591 bytes
"Jos�" <jose@127.0.0.1> a �crit dans le message de news: 0pdq42ljj1h2nfcm49fi96675444omqsol@4ax.com... >> >>It is in win32.hlp. > > I haven't got that help file. Just type "SHBrowseForFolder" in google. It will give you the following MSDN page. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp -- Regis St-Gelais www.laubrass.com
Re: A directory and TOpenDialog
Author: Timothy H. Buchman
Date: Mon, 24 Apr 2006 21:48
Date: Mon, 24 Apr 2006 21:48
15 lines
1686 bytes
1686 bytes
> 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
Re: A directory and TOpenDialog
Author: Hans Galema
Date: Tue, 25 Apr 2006 07:22
Date: Tue, 25 Apr 2006 07:22
14 lines
1417 bytes
1417 bytes
Jos� wrote: > WideString Root= "C:\\" ; You omitted my reply to use AnsiString only. Nor did you comment on it. Did you try ? >>It is in win32.hlp. > > I haven't got that help file. Isn't it somewere on a Borland update page ? Hans.
Re: A directory and TOpenDialog
Author: Jos�
Date: Tue, 25 Apr 2006 07:23
Date: Tue, 25 Apr 2006 07:23
31 lines
1967 bytes
1967 bytes
On Mon, 24 Apr 2006 14:38:10 +0300, "Minas EnRethy" <(min_charATyahooPUTADOTgr)(HellenicFire)> wrote in borland.public.cppbuilder.nativeapi: >> 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. >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. >> 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�
Re: A directory and TOpenDialog
Author: Jos�
Date: Tue, 25 Apr 2006 07:31
Date: Tue, 25 Apr 2006 07:31
16 lines
1604 bytes
1604 bytes
On Mon, 24 Apr 2006 17:26:00 -0400, "Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> wrote in borland.public.cppbuilder.nativeapi: >>>It is in win32.hlp. >> >> I haven't got that help file. > >Just type "SHBrowseForFolder" in google. >It will give you the following MSDN page. >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp Hm, that one requires some careful examination. I'll see you again next week. -- Jos�
Re: A directory and TOpenDialog
Author: Jos�
Date: Tue, 25 Apr 2006 08:04
Date: Tue, 25 Apr 2006 08:04
15 lines
1451 bytes
1451 bytes
On Tue, 25 Apr 2006 09:22:29 +0200, Hans Galema <notused@notused.nl> wrote in borland.public.cppbuilder.nativeapi: >> 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�
Re: A directory and TOpenDialog
Author: Hans Galema
Date: Tue, 25 Apr 2006 09:03
Date: Tue, 25 Apr 2006 09:03
9 lines
1357 bytes
1357 bytes
Jos� wrote:
> SelectDirectory((String)"Kies een map",Root,&dir);
> SelectDirectory(&dir,opt,0);
SelectDirectory( "Kies een map", Root, dir);
SelectDirectory( dir,opt,0);
Hans.
Re: A directory and TOpenDialog
Author: Jos�
Date: Tue, 25 Apr 2006 10:50
Date: Tue, 25 Apr 2006 10:50
18 lines
1634 bytes
1634 bytes
On Tue, 25 Apr 2006 11:03:43 +0200, Hans Galema <notused@notused.nl> wrote in borland.public.cppbuilder.nativeapi: >> SelectDirectory((String)"Kies een map",Root,&dir); >> SelectDirectory(&dir,opt,0); > > SelectDirectory( "Kies een map", Root, dir); > SelectDirectory( dir,opt,0); So stupid of me! I misinterpreted the '&' in the header. We have a simple solution now and can ditch all other suggestions. Thanks to everyone. Well, this one does not magically remember the directory if the program is restarted. Well, you can't have everything. -- Jos�
Re: A directory and TOpenDialog
Author: Hans Galema
Date: Tue, 25 Apr 2006 11:07
Date: Tue, 25 Apr 2006 11:07
9 lines
1372 bytes
1372 bytes
Jos� wrote: > So stupid of me! Schaamrood is het mooiste rood. Welcome to the club. We're not alone anymore. Hans.
Re: A directory and TOpenDialog
Author: JD
Date: Tue, 25 Apr 2006 15:45
Date: Tue, 25 Apr 2006 15:45
12 lines
1394 bytes
1394 bytes
Jos� <jose@127.0.0.1> wrote:
>
> that one requires some careful examination.
Search the archives:
http://www.tamaracka.com/search.htm
LOTS of samples in there - even a component version.
~ JD
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads