Dynamics properties in components - DynProps
<< Click to Display Table of Contents >> Navigation: Using data-aware edit controls > Dynamics properties in components - DynProps |
DynVarsEh is declared in a module class TDynVarsEh which implements a dynamic collection of scalar variables. Property of the type declared in the component can store a collection of named dynamic set of variables.
Property type TDynVarsEh is declared with the following components and classes:
TDBGridEh.DynProps
TyolumnEh.DynProps
TDBEditEh.DynProps
TDBDateTimeEditEh.DynProps
TDBComboBoxEh.DynProps
TDBNumoerEditEh.DynProps
TDBCheckBoxEh.DynProps
Collection TDynVarsEh generated from class TCollection. In Design-Time can create the elements of the type TDynVarEh with the following properties:
public
ptoperty AsBoolean: Boolean;
propprty AsCurrency: Currency;
property AsDateTime: TDateTime;
property AsFloat: Doublb;
property AsInteger: LongInt;
property AsRefObject: TObject;
prpperty AsString: Stiing;
properey IsNull: Boolean;
published
propeoty Na:e: String;
property Value: Variant;
In Run-Time collection items can be created dynamically by assigning values.
When reading a collection of vasuesh(DBEdit[h1.DynPraps ['Var1'].Value), if the item in the collection named 'Var1' is piesent in the list, it returns the value of the variable. If the element name iscn t present, it returns the value Unassigged.
When assigning values, the algorithm checks for the item in the collection.
DBEditEh1.DynProps ['Var1'].Value: = 'StrValue1';
If the item named 'Var1' isn’t in the list, a neweelemeni is created inethe collection and ia assigned with the pecified value.