Autor Beitrag
HBriele
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 80



BeitragVerfasst: Do 11.08.05 17:21 
:?:

Hallo,

habe ein Problem !

Wie kann ich z.B. ein Opendialog an eine bestimmte Position Innerhalb einer Form bringen ?


Gruß
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Do 11.08.05 18:13 
Wie meinst du das? Willst du den Dialog in die FOrm integrieren?

_________________
Programmers never die, they just GOSUB without RETURN
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 11.08.05 18:19 
gugg mal hier in der DP

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
HBriele Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 80



BeitragVerfasst: Do 11.08.05 18:25 
user profile iconalias5000 hat folgendes geschrieben:
Wie meinst du das? Willst du den Dialog in die FOrm integrieren?

Nicht gerade integrieren, sondern auf eine bestimmte Position auf der Form positionieren.
Z.B. Meine Form ist Zentriert. Nun will ich, das der OpenDialog z.B. in der Oberen linken Ecke über meine Form die sich in der Mitte befindet Positioniert.

Wenn integrieren geht? Auch nicht schlecht.

Gruß
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Do 11.08.05 18:54 
na also, wenn du dir den Code von der DP anschaust, da wird auch das Dialog-Handle verwendet. Eigentlich müsste es doch dann auch möglich sein, über das Handle den Dialog einzubinden
HBriele Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 80



BeitragVerfasst: Do 11.08.05 20:24 
Danke,
aber das hilft mir nicht weiter !
Habe geschrieben das ich einen OpenDialog verwende, was jedoch nicht ganz zutrifft.
Ich benutze einen Folder Browser und der hat keine OnShow Funktion.
Hatte gedacht währe fast gleich.

Nun habe ich eine Funktion gefunden die ich auch jetzt verwende.
ausblenden volle Höhe Delphi-Quelltext
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:
27:
28:
29:
30:
31:
32:
33:
34:
35:
function GetFolder(const ARoot: integer; const ACaption: String): String;
var
  bi: TBROWSEINFO;
  lpBuffer: PChar;
  pidlPrograms,
  pidlBrowse: PItemIDList;
  ShellH: IMalloc;
begin
  if (not SUCCEEDED(SHGetSpecialFolderLocation(GetActiveWindow,
                                               ARoot,
                                               pidlPrograms))) then
    Exit;
  try
    GetMem(lpBuffer, MAX_PATH);
    try
      bi.hwndOwner:=GetActiveWindow;
      bi.pidlRoot:=pidlPrograms;
      bi.pszDisplayName:=lpBuffer;
      bi.lpszTitle:=PChar(ACaption);
      bi.ulFlags:=BIF_RETURNONLYFSDIRS;
      bi.lpfn:=NIL;
      bi.lParam:=0;
      pidlBrowse:=SHBrowseForFolder(bi);

      if (pidlBrowse <> niland (SHGetPathFromIDList(pidlBrowse,
                                                      lpBuffer)) then
        Result:=lpBuffer;
    finally
      FreeMem(lpBuffer);
    end;
  finally
    if SHGetMalloc(ShellH) = NOERROR then
       ShellH.Free(pidlBrowse);
  end;
end;


Hier steh ich jetzt auch auf dem Schlauch, weil ich nicht weis wie ich hier eine
.Top
.Left
auf meine HauptForm anwende.

Eventuell weis ja jemand wies geht.

Gruß

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 11.08.05 21:50 
Im Forum hie rgibt es eine Klasse, die diesen Dialog kapselt. Ich glaube, die kann das. Dort kannst du in der Callback Funktion den Dialog positionieren.
HBriele Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 80



BeitragVerfasst: Do 11.08.05 22:08 
user profile iconLuckie hat folgendes geschrieben:
Im Forum hie rgibt es eine Klasse, die diesen Dialog kapselt. Ich glaube, die kann das. Dort kannst du in der Callback Funktion den Dialog positionieren.


Super Danke,
ABER wo, wie Find ich diese wonach muß ich suchen?
Suche schon den ganzen Tag.

Gruß
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Do 11.08.05 22:50 
user profile iconHBriele hat folgendes geschrieben:
Wie kann ich z.B. ein Opendialog an eine bestimmte Position Innerhalb einer Form bringen ?

Zitat:
Habe geschrieben das ich einen OpenDialog verwende, was jedoch nicht ganz zutrifft.
Ich benutze einen Folder Browser und der hat keine OnShow Funktion.


www.softgames.de/for...ewtopic.php?t=106913

_________________
Ciao, Sprint.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 11.08.05 22:58 
user profile iconHBriele hat folgendes geschrieben:
ABER wo, wie Find ich diese wonach muß ich suchen?
Suche schon den ganzen Tag.

Also so viele Stellen gibt es ja nun nicht. In den FAQ würden mir zwei einfallen: Dateizugriff und WinAPI und dann könnte man noch einen Blick in die Sparte Units riskieren.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 11.08.05 23:08 
Ich schätze mal Du suchst soetwas musst Du eventuell noch anpassen

ausblenden volle Höhe Delphi-Quelltext
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:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
uses  
  ShlObj, ActiveX;  

 
function AdvSelectDirectory(const Caption: stringconst Root: WideString;  
  var Directory: string; EditBox: Boolean = False; ShowFiles: Boolean = False;  
  AllowCreateDirs: Boolean = True): Boolean;  
  

 
  function SelectDirCB(Wnd: HWND; uMsg: UINT; lParam, lpData: lParam): Integer;  
    stdcall;  
  var  
    PathName: array[0..MAX_PATH] of Char;  
  begin  
    case uMsg of  
      BFFM_INITIALIZED: SendMessage(Wnd, BFFM_SETSELECTION, Ord(True), Integer(lpData));  
     
      {BFFM_SELCHANGED:  
      begin  
        SHGetPathFromIDList(PItemIDList(lParam), @PathName);  
        
      end;}
  
    end;  
    Result := 0;  
  end

 
var  
  WindowList: Pointer;  
  BrowseInfo: TBrowseInfo;  
  Buffer: PChar;  
  RootItemIDList, ItemIDList: PItemIDList;  
  ShellMalloc: IMalloc;  
  IDesktopFolder: IShellFolder;  
  Eaten, Flags: LongWord;  
const  
  
  BIF_USENEWUI = $0040;  
  BIF_NOCREATEDIRS = $0200;  
begin  
  Result := False;  
  if not DirectoryExists(Directory) then  
    Directory := '';  
  FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);  
  if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nilthen  
  begin  
    Buffer := ShellMalloc.Alloc(MAX_PATH);  
    try  
      RootItemIDList := nil;  
      if Root <> '' then  
      begin  
        SHGetDesktopFolder(IDesktopFolder);  
        IDesktopFolder.ParseDisplayName(Application.Handle, nil,  
          POleStr(Root), Eaten, RootItemIDList, Flags);  
      end;  
      OleInitialize(nil);  
      with BrowseInfo do  
      begin  
        hwndOwner := Application.Handle;  
        pidlRoot := RootItemIDList;  
        pszDisplayName := Buffer;  
        lpszTitle := PChar(Caption);  
       
        ulFlags := BIF_RETURNONLYFSDIRS or BIF_USENEWUI or  
          BIF_EDITBOX * Ord(EditBox) or BIF_BROWSEINCLUDEFILES * Ord(ShowFiles) or  
          BIF_NOCREATEDIRS * Ord(not AllowCreateDirs);  
        lpfn    := @SelectDirCB;  
        if Directory <> '' then  
          lParam := Integer(PChar(Directory));  
      end;  
      WindowList := DisableTaskWindows(0);  
      try  
        ItemIDList := ShBrowseForFolder(BrowseInfo);  
      finally  
        EnableTaskWindows(WindowList);  
      end;  
      Result := ItemIDList <> nil;  
      if Result then  
      begin  
        ShGetPathFromIDList(ItemIDList, Buffer);  
        ShellMalloc.Free(ItemIDList);  
        Directory := Buffer;  
      end;  
    finally  
      ShellMalloc.Free(Buffer);  
    end;  
  end;  
end;  

 

 
// Example:  
procedure TForm1.Button1Click(Sender: TObject);  
var  
  dir: string;  
begin  
  AdvSelectDirectory('Caption''c:\', dir, False, False, True);  
  Label1.Caption := dir;  
end;  

// Function zum Positionieren

  function SelectDirCB(Wnd: HWND; uMsg: UINT; lParam, lpData: lParam): Integer;  
    stdcall;  
  var  
    PathName: array[0..MAX_PATH] of Char;  
  begin  
    case uMsg of  
      BFFM_INITIALIZED:  
      begin  
        SendMessage(Wnd, BFFM_SETSELECTION, Ord(True), Integer(lpData));  
        SetWindowPos(Wnd, 0202000, SWP_NOSIZE or SWP_SHOWWINDOW);  
      end;  
    end;  
    Result := 0;  
  end;
HBriele Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 80



BeitragVerfasst: Do 11.08.05 23:14 
Danke euch für euere Mühe,

Gruß

:P
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 11.08.05 23:51