RAD Studio
ContentsIndex
PreviousUpNext
Adding Interface Properties

Before proceeding, decide on the properties your wrapper needs to enable developers to use your dialog box as a component in their applications. Then, you can add declarations for those properties to the component's class declaration. 

Properties in wrapper components are somewhat simpler than the properties you would create if you were writing a regular component. Remember that in this case, you are just creating some persistent data that the wrapper can pass back and forth to the dialog box. By putting that data in the form of properties, you enable developers to set data at design time so that the wrapper can pass it to the dialog box at runtime. 

Declaring an interface property requires two additions to the component's class declaration:

  • A private class field, which is a variable the wrapper uses to store the value of the property
  • The published property declaration itself, which specifies the name of the property and tells it which field to use for storage
Interface properties of this sort do not need access methods. They use direct access to their stored data. By convention, the class field that stores the property's value has the same name as the property, but with the letter F in front. The field and the property must be of the same type.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!