TopenDialog/TSaveDialog with owner-drawn items

425 views Asked by At

I want to implement the traditional open and save dialogs (and the underlying items being dealt with are files), but I want to have control over what is displayed in place of the filename, and include some graphics - i.e. I need an "ownerdraw" style of dialog. Apart from that aspect, I want the dialog to look and feel as much like the traditional open/save dialogs as possible.

I figure I'm faced with implementing this myself, I'm just wondering where the best place to start is.

2

There are 2 answers

1
RRUZ On

AFAIK the level of customization which you need is not provided by the standard windows dialogs, but you can try the TShellListView(TCustomShellListView) component which is part of the ShellCtrls unit (this package is not installed in the Delphi IDE by default), from here you can obtain the code to fill your own TListview with the folder contents and draw the items as you want, also take a look to the Shell Interfaces to interact with the elements of the shell.

0
Warren  P On

For an owner-draw control to use as a list view, I would recommend Roy Klever's rkSmartView.

http://rmklever.com/?page_id=299

The demo app Roy posted on the blog above contains a pretty decent sample of a graphics thumbnail browser which could be turned into the core of what you're doing. He adds rating "stars" and all manner of other owner-drawn decoration.

http://rmklever.com/?p=318

Owner draw on a standard common control like TListView is fraught with limitations. If you want to owner draw all or part of the control a completely virtual control that is 100% internally drawn and 100% source code provided is the only way to be sure you won't hit a wall or end up with a 98% solution that you can't bring all the way home.

I recently did something similar by modifying the above component and it turned out well.