Home Component Writing
New Blog Posts: Merging Reports - Part 1 and Part 2

How can a component know it is in design mode?

edited November 2003 in Component Writing
I need my custom components to know whether they are in the design window,
or being printed/previewed.

E.g. in design mode I need a component to read stuff from a database to
build a menu to allow some user configuration. But for production use (while
printing) this would waste time.

How can I get a boolean value that says whether the user is designing or
printing?

--


Mvh/regards
Svein Olav Mytting
4 Parkside House
52/54 High Street Wimbledon
London SW19 5AY
Tel: 020 8946 2032
Mob: 077 9301 6870
Fax: 0845 3519936

Comments

  • edited November 2003
    Check whether pppcDesigning in DesignState. You will find this throughout
    the RB source code. This indicates that the component is being used inside
    the report designer. Note that a report can also be previewed while the
    component is in this state.

    if (pppcDesigning in DesignState) then
    {do something here}

    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Thanks. It seems like, however, that (pppcDesigning in DesignState) is never
    true in the OnCreate event. Any suggestion which event I should rather use
    to initialize my custom components in the designer?

    As I mentioned I need my components to read information from a database
    (only once) when in design mode. This should work with new components that
    the user creates in the designer, as well as with components present in the
    report when the designer is opened.

    Regards,
    Svein Olav Mytting

  • edited November 2003
    Perhaps try overriding the DSChanged method that is decle\ared in
    TppPrintable.

    A component will be pppcDesigning until its Band property is assigned and
    the Report is attached to the designer.



    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com

    Best regards,

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