Home General

Fired event when PrinterSetup dialog gets closed (or page margins changed)

edited December 2011 in General
Hello,

as the title says, I'm looking for an event, which is being fired, when
PrinterSetup dialog within the designer gets closed (or page margins
changed).

Is there one?

Regards,
Mark

Comments

  • edited December 2011
    There is no such event. You can create a custom descendant of the dialog and
    then register it as a replacement to the built-in dialog. The
    PageSetupDialog is defined in ppPgSDlg.pas, the registration appears in the
    Initialization/Finalization at the bottom. The dialog is displayed by the
    TppDesignDialogController.ShowPageSetupDialog method, defined in
    ppDesignDialogController.pas


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2011
    Thanks for your reply, Nard.

    Inbetween I've tried the Designer.Report.PrinterSetup.OnPageDefChange event.
    I.e. I'm assigning an event handler at runtime. It *seems* to work for my
    purpose (I need to react when page margins are being changed), but not
    completely. A kind of "refresh" is missing when I change the margins.
    Usually I see the designer space become bigger, if the margins become
    smaller, and the other way around - immediately that is.

    Once I assign the Designer.Report.PrinterSetup.OnPageDefChange event, I see
    the changes only after I change the margins, switch to the preview and back.
    Calling "inherited" doesn't help.

    Since it works in general, it can't be a completely wrong way, can it?
  • edited December 2011
    That approach could cause an issue. Internally the TppReport class uses the
    PrinterSetup.OnPageDefChange event. Or to be more precise, TppProducer, the
    ancestor to TppReport uses it. In ppProd.pas, check out the constructor,
    TppProducer.Create to see where this is assigned.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.