Autor Beitrag
JRegier
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Sa 30.07.05 18:28 
Hi, ich möchte dass der Benutzer mit dem OpenDialog ein Verzeichnis wählen kann
dass ich dann in eine Edit Komponente schreibe! Aber wenn ich ein Verzeichnis
wähle und auf öffnen klicke wechselt er ins verzeichnis und öffnet nicht dieses
Verzeichnis! In Java kenn ich das so dass ich da einstellen kann was ich auswählen
will!
SMO
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 120
Erhaltene Danke: 18


D2005 Personal
BeitragVerfasst: Sa 30.07.05 18:37 
OpenDialog ist für Dateien gemacht. Du suchst was wie Suche in: Delphi-Forum, Delphi-Library SHBROWSEFORFOLDER.
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: So 31.07.05 09:19 
Hi JRegier,

ich bin noch viel zu "neu" hier im Delphi-Forum um so einen alten Hasen wie dich auf die Suche oder die FAQ hinweisen zu können... deshalb lasse ich es und gebe dir direkt drei FAQ Links ohne jeglichen Kommentar. ;-)

...einen Verzeichnisauswahl-Dialog anzeigen?
...einen Verzeichnisauswahl-Dialog anzeigen? #2 (Delphi)
...einen Verzeichnisauswahl-Dialog anzeigen? #3

Lg Martin
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: So 31.07.05 10:39 
Super es klappt! Danke! Aber kann mir einer sagen wie ich dieses Dialog im Desktop Center anzeigen lasse?
In der Hilfe habe ich nichts gefunden..
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Di 02.08.05 10:49 
Das nur mit etwas mehr Aufwand möglich:

Nehmen wir an du hast diesen FAQ Beitrag benutzt: ...einen Verzeichnisauswahl-Dialog anzeigen?. In Zeile 26 des ersten geposteten Sourcecodes beginnen die Zuweisungen der benötigten Eigenschaften (TBrowseInfo) um den Dialog anzeigen zu können. Um das Fenster jetzt zentriert darzustellen musst du eine Callback-Funktion definieren. Diese Callback-Funktion musst du als erstes dem TBrowseInfo-Rekord bekannt geben:

ausblenden Geänderter Sourcecode aus FAQ
 
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
{ ... }
  // BrowseInfo mit Werten füllen
  FillChar (BrowseInfo, SizeOf (BrowseInfo), 0);
  With BrowseInfo Do
    Begin
      hwndOwner := 0;
      pszDisplayName := @DisplayName;
      lpszTitle := PChar (aCaption) ;
      ulFlags := 0 ;
      lpfn := BrowseDialogCallBack;
    End;


Jetzt werden einige (alle?) Messages an die Callback-funktion weitergeleitet und du kannst in dieser funktion das Fenster zentrieren:

ausblenden BrowseDialogCallBack()
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
function BrowseDialogCallBack
  (Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): 
  integer stdcall;
var
  wa, rect : TRect;
  dialogPT : TPoint;
begin
  //center in work area
  if uMsg = BFFM_INITIALIZED then
  begin
    wa := Screen.WorkAreaRect;
    GetWindowRect(Wnd, Rect);
    dialogPT.X := ((wa.Right-wa.Left) div 2) - 
                  ((rect.Right-rect.Left) div 2);
    dialogPT.Y := ((wa.Bottom-wa.Top) div 2) - 
                  ((rect.Bottom-rect.Top) div 2);
    MoveWindow(Wnd,
               dialogPT.X,
               dialogPT.Y,
               Rect.Right - Rect.Left,
               Rect.Bottom - Rect.Top,
               True);
  end;

  Result := 0;
end;


Das ganze ist hier in englisch beschrieben.

Lg Martin
JRegier Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Di 02.08.05 12:01 
Und wie kann man ein bestimmtes Verzeichnis als InitialDir machen?
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Di 02.08.05 12:42 
Suchen.