Delphi 7 - Embedded file open dialog in a form

自闭症网瘾萝莉.ら 提交于 2019-12-07 21:35:50

问题


Does anyone know if it is possible to embed a file open dialog inside your own form?

We have a tabbed dialog and on one of the tabs we want the user to be able to browse for a file with the same functionality as the the standard open dialog e.g. 'Look in' combobox, places bar, shell file list, file name comboedit with name completion etc etc.

I've looked at recreating the dialog with some 3rd party components, namely Jam Shell Browser Components

I can get most of the functionality this way, but I'm missing a couple of things e.g. the places bar and the filename auto completion\suggestion


回答1:


I don't want to say it's impossible but considering the amount of ugly winapi hacks you'd probably involve I suggest "recreating the dialog with some 3rd party components" but with VirtualShellTools.
VirtualShellTools can be downloaded from this SVN archive.
And here's the google code project page.

(At least it has the filename autocompletion combobox though i am not sure if it has the places bar). Hope it helps.




回答2:


The places bar is not that difficult to implement using a TListView component set to large icons. The Raize Components library also has some source that would help in this arena.




回答3:


Just a small note, it's fairly easy to add an auto-completing combobox with SHAutoComplete.

See this article for details.




回答4:


Maybe this Shell Controls Demo can help you.

Edit: ATM the site seems to be down. The Wayback Machine helps.
Here's the latest download link for the controls involved from the wayback machine:




回答5:


I would re-create it: it shouldn't take long with the VCL Components. The autocomplete is not hard, and you can get the rest of the data if you look through the windows docs long enough.

You can try and cheat by detecting the tab change and displaying the open dialog as if it were the tab page. You will have to detect the user clicking outside of the dialog (e.g. on a different tab) and prevent it closing until you want to change tabs.

Cheers



来源:https://stackoverflow.com/questions/272489/delphi-7-embedded-file-open-dialog-in-a-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!