RAD Studio
ContentsIndex
PreviousUpNext
Writing the Implementation Method

When the read or write part of a property definition uses a method instead of directly accessing the stored property data, you need to implement the method. 

Add the implementation of the SetShape method to the implementation part of the unit:

procedure TSampleShape.SetShape(Value: TSampleShapeType);
begin
  if FShape <> Value then                           { ignore if this isn"t a change }
  begin
    FShape := Value;                                { store the new value }
    Invalidate;                                     { force a repaint with the new shape }
  end;
end;

 

void __fastcall TSampleShape::SetShape(TSampleShapeType Value)
{
  if (FShape != Value)             // ignore if this isn't a change
  {
     FShape = Value;               // store the new value
     Invalidate();                 // force a repaint with the new shape
  }
}
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!