Board index » delphi » TPrinterSetupDialog - attaching an OnShow event handler

TPrinterSetupDialog - attaching an OnShow event handler


2004-01-03 07:24:37 AM
delphi22
I am building a call to the PrinterSetup dialog inside a Component I am
building.
So I am creating an instance of the TPrinterSetupDialog with this code
(rather than using the actual component from the pallette)
PDS := TPrinterSetupDialog.Create(Self);
try
if PDS.Execute then
begin
....
....
end;
finally
PDS.Free
end;
I want to attach a handler function to the OnShow event of the TPrinterSetup
dialog.
How do I declare the handler function and how to I attach it to the event.
Thanks in advance.
Philip
 
 

Re:TPrinterSetupDialog - attaching an OnShow event handler

"Philip B Cook" <XXXX@XXXXX.COM>writes:
Quote
I want to attach a handler function to the OnShow event of
the TPrinterSetup dialog. How do I declare the handler
function and how to I attach it to the event.
First, it must have the same signature that the dialog expects.
You can get that by simply dropping the component on a form
and creating the event or by using the help.
Then make that function a member of your new component like
you would any other function and simply assign it after the
dialog has been created (assumes that you named the function
OnShow):
PDS := TPrinterSetupDialog.Create(Self);
PDS.OnShow := OnShow;
try
....
~ JD