home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
pcmagazi
/
1992
/
20
/
ln1120
/
custom2.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-07-30
|
2KB
|
87 lines
{
Title: Revised CUSTOM1.PAS
Caption: The highlighted areas show where we have added code to
fix a painting problem in the listboxes of the Open common dialog
customized with BWCC controls. When a WM_ERASEBKGND message is received,
the TCDListBox object forces the entire listbox rectangle to
be erased with the system window background color (normally white).
TBWCCFileDlg.Init constructs one of these listbox objects for each
of the two listboxes in the Open common dialog.
}
unit custom2; { REVISED }
interface
uses winprocs, wintypes, wobjects, bwcc, utest2;
type
PBWCCFileDlg = ^TBWCCFileDlg;
TBWCCFileDlg = object(TFileDlg)
constructor Init(AParent : PWindowsObject;
AFlags : Longint;
AFileName : Pchar;
ANameLength : Integer);
end;
implementation
{$R custom1}
uses commdlg;
{***EDITOR: Begin highlight or bold}
type
PCDListBox = ^TCDListBox;
TCDListBox = object(TListBox)
Brush: HBrush;
constructor InitResource(AParent: PWindowsObject; ResourceID: Word);
destructor Done; virtual;
procedure WMEraseBkgnd(var Msg : TMessage);
virtual wm_first+wm_EraseBkgnd;
end;
constructor TCDListBox.InitResource(AParent: PWindowsObject; ResourceID: Word);
begin
TListbox.InitResource(AParent, ResourceID);
Brush := CreateSolidBrush( GetSysColor( COLOR_WINDOW));
end;
destructor TCDListBox.Done;
begin
DeleteObject(Brush);
TListbox.Done;
end;
procedure TCDListBox.WMEraseBkgnd(var Msg: TMessage);
var
R : TRect;
begin
GetClientRect(hWindow,R);
FillRect(hDC(Msg.wParam),R,Brush);
Msg.Result := 1;
end;
{***EDITOR: End highlight or bold}
constructor TBWCCFileDlg.Init(AParent : PWindowsObject;
AFlags : Longint;
AFileName : Pchar;
ANameLength : Integer);
{***EDITOR: Begin highlight or bold}
var
Dummy: PWindowsObject;
{***EDITOR: End highlight or bold}
begin
TFileDlg.Init(AParent, AFlags, AFileName, ANameLength);
with OFN do
begin
Flags := Flags or OFN_EnableTemplate;
lpTemplateName := 'FileOpen_BWCC';
end;
{***EDITOR: Begin highlight or bold}
Dummy := New(PCDListBox, InitResource(@Self, 1120));
Dummy := New(PCDListBox, InitResource(@Self, 1121));
{***EDITOR: End highlight or bold}
end;
end.