Difference between revisions of "RTTI controls"

From Free Pascal wiki
Jump to navigationJump to search
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{RTTI controls}}
 
{{RTTI controls}}
  
== Introduction ==
+
This page describes the package '''RunTimeTypeInfoControls''' in <lazarusdir>/components/rtticontrols/.
 
 
This page describes the package RunTimeTypeInfoControls in <lazarusdir>/components/rtticontrols/.
 
  
 
RTTI controls extend many LCL controls by the ability to directly connect to published properties of classes.
 
RTTI controls extend many LCL controls by the ability to directly connect to published properties of classes.
Line 10: Line 8:
 
In combination with [[Streaming components]] you can reduce the amount of code needed for connecting the program Data with the GUI and the Disk/Network to a minimum.
 
In combination with [[Streaming components]] you can reduce the amount of code needed for connecting the program Data with the GUI and the Disk/Network to a minimum.
  
A good explanation on RTTI for delphi that can apply to freepascal too can be found here:
+
==Testing Components==
http://www.blong.com/Conferences/BorConUK98/DelphiRTTI/CB140.htm
+
The RTTI controls are very useful when writing/testing a component.
 +
 
 +
*Drop the component onto a form
 +
*Drop an RTTI control onto the form
 +
*Set the RTTI component's '''Link.TIObject''' property to your component
 +
*Set the RTTI component's '''Link.TIPropertyName''' (from the drop-down list) to the property
 +
*You can now edit the property interactively and see the effects of your changes at runtime (and sometimes designtime; depending on the component)
 +
*Each RTTI control will try to invoke the appropriate property editor for your chosen property.
 +
 
 +
So for instance, if the property is a StringList type, the RTTIButton would bring up the StringList editor, the RTTIMemo would display it - all without writing a line of code!
  
 
== See Also ==
 
== See Also ==
 
+
* [http://www.blong.com/Conferences/BorConUK98/DelphiRTTI/CB140.htm explanation on RTTI for delphi that can apply to Free Pascal too]
*[[Runtime Type Information (RTTI)]]
+
* [[Runtime Type Information (RTTI)]]
 +
* [[RTTI tab]]
 +
* [https://www.freepascal.org/~michael/articles/#rtti explanation on RTTI controls in Lazarus]

Latest revision as of 08:32, 10 June 2020

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) português (pt) русский (ru)

This page describes the package RunTimeTypeInfoControls in <lazarusdir>/components/rtticontrols/.

RTTI controls extend many LCL controls by the ability to directly connect to published properties of classes. They greatly reduce writing boring code, by automatically loading/saving data between LCL controls and published properties. In fact, you can create fully functional forms without writing any code at all.

In combination with Streaming components you can reduce the amount of code needed for connecting the program Data with the GUI and the Disk/Network to a minimum.

Testing Components

The RTTI controls are very useful when writing/testing a component.

  • Drop the component onto a form
  • Drop an RTTI control onto the form
  • Set the RTTI component's Link.TIObject property to your component
  • Set the RTTI component's Link.TIPropertyName (from the drop-down list) to the property
  • You can now edit the property interactively and see the effects of your changes at runtime (and sometimes designtime; depending on the component)
  • Each RTTI control will try to invoke the appropriate property editor for your chosen property.

So for instance, if the property is a StringList type, the RTTIButton would bring up the StringList editor, the RTTIMemo would display it - all without writing a line of code!

See Also