size : 1952
uploaded_on : Tue May 11 00:00:00 1999
modified_on : Wed Dec 8 14:03:40 1999
title : Extending TOpenDialog
org_filename : ExtOpenDlg.txt
author : Mark Irving
authoremail : markirivng@bigpond.com
description : How to extend the TOpenDialog to add a file preview thumbnail
keywords :
tested : not tested yet
submitted_by : The CKB Crew
submitted_by_email : ckb@netalive.org
uploaded_by : nobody
modified_by : nobody
owner : nobody
lang : plain
file-type : text/plain
category : delphi-components
__END_OF_HEADER__
With guess work (and following the Borland TOpenPictureDialog example) I
managed to extend the TOpenDialog to add a file preview thumbnail and some
file status info below the standard win98 common dialog. The key steps are
defining a template dialog resource which seems to define the fixed size of
the extension area and create some panels and controls on the fly to fit in
this area.
The dialog resource looked like
DOCOPENDIALOG DIALOG 0, 0, 240, 160
STYLE 0x404L | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
{
LTEXT "", 1119, 0, 0, 240, 80, NOT WS_VISIBLE | WS_GROUP
}
The new open dialog looks like
TDocOpenDialog = class(TOpenDialog)
private
fthumbnail: tPicture; // picture to hold thumbnail
{ controls defined at runtime }
fPicturePanel: TPanel; // panel all controls set on
fThumbImage: TImage; // thumbnail image display
BottomBox, // bottom group box
TopBox: TGroupBox; // top group box
SubjectLab, // data static labels
AuthorLab,
TitleLab,
FileDataLab,
AppNameLab,
AppRevLab: tLabel;
etc
constructor TDocOpenDialog.Create(AOwner: TComponent);
{ Allocate memory and create custom control additions to commdlg }
begin
inherited Create(AOwner);
{ alloc mem }
FPicturePanel := TPanel.Create(Self);
fThumbnail:=tPicture.create;
{ create controls at runtime }
with FPicturePanel do
begin
Name := 'PicturePanel';
Caption := '';
SetBounds(4, 5, 204, 200);
BevelOuter := bvNone;
BevelInner := bvLowered;
BorderWidth := 3;
TabOrder := 1;
fThumbImage:=Timage.create(Self);
with fThumbImage do begin
Name := 'ThumbnailPic';
SetBounds(4, 4, 154, 114);
AutoSize := False;
Parent := FPicturePanel;
Stretch:=true;
end;
etc
This may help. I never found written documentation on this.