Selecting a directory with TOpenDialog

后端 未结 5 1032
长情又很酷
长情又很酷 2020-12-04 17:40

I\'d really like to know the various ways I could select a directory with the TOpenDialog, whether it be downloading a new component or using what is provided by Delphi, but

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 18:01

    If you are using JVCL you can use TJvSelectDirectory. With this you can switch between old and new style by setting a property. For example:

    Dlg := TJvSelectDirectory.Create(Self);
    try
        Dlg.Title := MyTitle;
        Dlg.InitialDir := MyStartDir;
        Dlg.Options := Dlg.Options + [sdAllowCreate, sdPerformCreate];     
        Dlg.ClassicDialog := False;   //switch style
        if Dlg.Execute() then
          NewDir := Dlg.Directory;
    finally
        Dlg.Free;
    end; 
    

提交回复
热议问题