TMultiPropertyLink

From Free Pascal wiki
Revision as of 06:20, 1 April 2022 by Egsuh (talk | contribs) (Created page with "TMultiPropertyLink enables linking all child RTTI controls' TIObject to a single component at once via TMultiPropertyLink. For example, create a form, drop a TEdit (name is...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

TMultiPropertyLink enables linking all child RTTI controls' TIObject to a single component at once via TMultiPropertyLink.

For example, create a form, drop a TEdit (name is Edit1), a TPanel (name is Panel1) and a TMultiPropertiLink (name is MultiPropertyLink1). Then drop two TTiEdit (names are TiEdit1 and TiEdit2) on the TPanel.

Now, we'd like to display the width of Edit1 in TiEdit1, and the content of Edit1 (it's text property of Edit1) in TiEdit2.

We can do this one by one --- setting Link.TIObject of both TiEdit1 and TiEdit2 as Edit1, and then setting their LInk.TIPropertyName as "Width" and "Text" each. But as both TIEdit1 and TIEdit2 share parent and Link.TIObject, then can be put in a TMultiPropertyLink.

Set MultiPropertyLink's properties as follows in Object Inspector.

    MarginSiblings=False
    ParentControl=Panel1
    TIObject=Edit1

Set following properties.

    TIEdit1.Link.TIPropertyName='Width'
    TIEdit2.Link.TIPropertyName='Text'

When you run this program, you will see that both width and text of Edit1 are displayed within TTIEdits within Panel1. You can see the width of Edit1 changes if you change the width value manually by editing TiEdit1's value. You can change the text property either in the TIEdit2 of Edit1.

But there should only RTTI controls within Panel1.