AW: [lazarus] CustomFormEditor

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Nov 20 20:05:23 EST 2000


On Sat, Nov 18, 2000 at 09:10:31PM -0600, Shane Miller wrote:
> OK, I added more code for the customformeditor.  I added some code in
customformeditor.pp for the class TComponentInterface.  The problem is I don't
know what the hell I am doing when it comes to getting typeinfo and calling
GetPropInfo or stuff like that.
>
> Can anyone help me?  The TComponentInterface has functions like
GetPropvaluebyname but I'm not sure how to go about doing that.

The TFiler descendents TReader and TWriter in fcl/inc/classesh.inc describes
in detail how to read and write all published properties. There is a little
overhead because they must also handle ascendent values to avoid redundance,
which is of no use for the FormEditor.

>All you do it call the ComponentInterface's Set method and pass it a value.
>The ComponentInterface is used to query the values and
>set the values for the control.  That's it's purpose.

Ok.
Because the Property Editors knows much better than any universal wrapper the
boundaries of a value, they will check for validation. So the
TComponentInterface don't need much checks.

>The control will update it's look/position/size/etc. based on it's new value.

For these examples a rather simply interface is sufficient, because writing to
the values (borderstyle, left, top, width, height) will do the tricks
automatically.

>Let's say the FormEditor has a TButton focused.  When it get's focused I send
the OI the TComponentInterface for that control or I call a function letting
you know that the control that is active has changed.  I could send you the
name of the control and you could then call FormEditor's FindComponent passing
it the name.  I would return to you an TIComponentInterface which would allow
you to get a list of all it's methods and properties along with
setting/getting the values for these properties.

>When something changes in that control you call the ComponentInterface set
passing the NAME of the property and the value.  Then I do what I need to and
set that property.

I think, instead of names we can take the typinfo/classes structures. This is
faster and we don't need to invent the wheel II.

Mattias






More information about the Lazarus mailing list