Home General

Repainting a component after changing own properties

edited July 2010 in General
Hi all,

I wondered for some time now, how it is possible to repaint a component
immediately after changing a the value of a self-defined property, with
using (and confirming by mrOk) a self-created property editor (over the
[...] button in the object inspector) or without using any property
editor by just entering the new value into the specific property-field
in the object inspector.

The best explanation for what I'm looking for is the Caption-property on
the Label. While altering the property-value, the change is immediately
visible in the designer (on the component).

This is the class of the property-editor I'm using:

TrbInspectorFormulaItem = class(TppJvCustomInspectorItem)
public constructor Create(const AParent: TppJvCustomInspectorItem;
const AData: TppJvCustomInspectorData); override;
public destructor Destroy; override;

protected function Formula: TutFormula;

protected function GetDisplayValue: string; override;
protected procedure SetDisplayValue(const Value: string); override;
protected procedure Edit; override;
protected procedure SetFlags(const Value: TInspectorItemFlags);
override;


In the Edit procedure we create a dialog, show the current
property-value and offer an opportunity to change it. If the dialog is
confirmed, we change the value, but the change isn't visible in the
designer, only after moving the component (and recall the
PaintDesignControl method from the TppCustomComponentControl-deviation)
it gets painted...

I hope I made it clear what I mean and you are able to help me out.

Thanks in advance.

Nicola Studer

Comments

  • edited July 2010
    Hi Nicola,

    Take a look at the Checkbox demo located in the \Demos\6. RCL\... directory
    (MyChkBox.pas). Pay particular attention to the property setters which will
    notify the report engine and design control that something has been changed
    essentially updating the designer window. The inspector simply updates the
    property value it represents and it is up to the component itself to notify
    and update the design control.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2010
    On 20.07.2010 18:55, Nico Cizik (Digital Metaphors) wrote:
    I got it and it works now. Thanks for the fast reply.

    Nicola
This discussion has been closed.