[lazarus] TIComponentInterface --Set/Get methods

Shane Miller SMiller1 at stvgb.org
Mon Nov 20 13:50:19 EST 2000


I agree that you could call the SetORdValue for the control but the TIComponentInterface is supposed to be doing this isn't it?  That way it can set the FFormEditor.Modifed to true and do anything else it needs to do.  You won't need to worry about it.  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.  

The FormEDITOR doesn't know what changed.  You are right.  The control will update it's look/position/size/etc. based on it's new value.  The FormEditor will know that something changed because the FormEditor.Modifed was changed to TRUE.  That's about all it knows.

When a value changed in the OI I was imagining that you would call the TComponentInterface.SetPropByName
method and it would alert the FormEditor that it's been modified since it was loaded last, and change the control's function.  If other properties changed in the control then you need to detect them using RTTI.  You can get this information from the TComponentInterface because it uses RTTI to get all this information.

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.

Seem reasonable?
Shane


>>> nc-gaertnma at netcologne.de 11/20/00 12:13PM >>>
>Second:  I was thinking that the Set/Get methods for the
>TComponentInterface would be used by the Object Inspector and the FormEditor.

>When someone changed something in the OI they could then
>call the Set method for the TICOmponentInterface and
>it would change it.  Otherwise how does the FormEditor
>know what changed?

Delphis FormDesigner don't know what has changed and still works. All values
are read just in time via RTTI.
There is a reason for this:
If a property is changed, some other properties can change too. How will the
TComponentInterface ever know, if not by reading all from the RTTI?
What value changes the FormEditor needs to know?


>Where would the OI store what was changed?
>It would need to set the new value to the property wouldn't it?

It "stores" the values simply via the RTTI. For integer values this is a
simple SetOrdValue. In fact, it changes the real value of the running form.

Mattias

_________________________________________________________________
     To unsubscribe: mail lazarus-request at miraclec.com with
                "unsubscribe" as the Subject
    archives at http://www.miraclec.com/list_archives/lazarus






More information about the Lazarus mailing list