Recent

Author Topic: Please confirm on the rtti controls' actions  (Read 1501 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1273
Please confirm on the rtti controls' actions
« on: January 28, 2022, 08:14:59 am »
Hi,
I love RTTI controls. I'd like to confirm following.

I assign a property name to RTTI controls during design. That is,

         RTTIControl.Link.TIPropertyName := SomePropertyOfMyComponent;

And I assign its TiObject dynamically during runtime, i.e.

         RTTIControl.Link.TIObject := MyComponent;

But assigning   RTTIControl.Link.TIObject := nil;    seems to raise exception if the TIPropertyName remains.

Is this true?


egsuh

  • Hero Member
  • *****
  • Posts: 1273
Re: Please confirm on the rtti controls' actions
« Reply #1 on: January 28, 2022, 08:32:04 am »
Changing tiobject causes problem, whether it's nil or not.

egsuh

  • Hero Member
  • *****
  • Posts: 1273
Re: Please confirm on the rtti controls' actions
« Reply #2 on: January 28, 2022, 09:03:49 am »
Can I use RTTI controls only with TComponent descendants, not with TPersistent?

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Please confirm on the rtti controls' actions
« Reply #3 on: January 28, 2022, 10:43:41 am »
Can I use RTTI controls only with TComponent descendants, not with TPersistent?
Well, TPersistent causes its descendants to have RTTI information, because it is compiled in {$M+} state, so in principle this should be possible for any Tpersistent derived class.. Note that the properties should be published, not public.
« Last Edit: January 28, 2022, 10:45:58 am by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018