Link to home
Start Free TrialLog in
Avatar of lmikle
lmikle

asked on

SelectDirectory control

How can I control API SelectDirectory Browser?

I need to put it in Pos(X,Y) and set current selected directory in browser tree.
Avatar of PeterLarsen
PeterLarsen

var
D : TopenDialog;
begin
D:=Topendialog.create(self);
//Do what you want.
D.Execute;

Regards
Peter
This method goes for other kind of dialogs too ...
ASKER CERTIFIED SOLUTION
Avatar of Lischke
Lischke

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Peter, please post comments first. In particular if you cannot be sure your contribution is what the questioneer wants (and you solution is wrong in this case).

Thank you and

Ciao, Mike
Well Mike, Nice code you have there :-)
I agree, but i dont see why it's wrong - it's just a different way to do it.

Regards
Peter
:-)) No, there's a huge difference! You open the file open dialog (a listview) while I'm using the folder open dialog (a treeview) which is for example used in install programs.

Nice trial anyway ;-)

Ciao, Mike
Well, he is free to reject the answer.
Or you could use TBrowseFolder, downloadable from DSP (http://sunsite.icm.edu.pl/delphi)

This wraps SHBrwoseForFolder and allows you to easily set the initial directory...

We use it in our products...

Cheers,

Raymond.
Avatar of lmikle

ASKER

Sorry, but I need to control Windows API SelectDirectory. In FileCtrl this function is discribed as
 function SelectDirectory ( const Caption : String; const Root : WideString; out Dir : String) : Boolean;

It Havn't any InitialDir parameter or another.

In program it uses as

var
 LastDir; // contain a last visited directory

....
....

var
 Fldr : String;

....

If SelectDirectory('Open folder','Desktop',Fldr) Then
 Begin
  ...
  LastDir := Fldr;
 End;

....

But i find in any programs (Microsoft's Find for example) that this dialog can be positioned in any place and initial folder was selected in tree.

May be initial dir can be selected by passing special format Root parameter? or by any CallBack function without overloading SelectDirectory.

Am I invisible or what? lmikle, would you please look at the code I posted above? It contains exactly what you need!

Ciao, Mike
Imikle,

mike(Lischke) has posted what you want ,the  SelectDirectory with a callback proc .
there is a example comp for this i think at delphifreestuff but it does the same as mike posted .
mike you should post as answer it works fine..
Thank you Barry for standing by and lmikle for the points. I hope it is really want you need, lmikle. Otherwise just ask...

Ciao, Mike