DFM conversion routines |
Top Previous Next |
DFM-Translator > Special assignments > DFM conversion routines The names for the DFM conversion routines are constructed in a systematically way: depending on whether the procedure is used for a simple assignment or whether a function is used to assign a new variable instance, its name starts with Assign or Create. For collections functions with the prefix Get can be created. As fourth kind of procedures events can be defined.
The second part of the name of the assignment function specifies a type. This type is either assigned a property, or an element is created or modified in it, or an event occurs on it.
The type is either the concrete type of the current element - e.g. TButton - or one of the following base classes. In the latter case, the initial 'T' is omitted from the name.
Assignment procedures for these base classes are applied to all elements with types, which are derived from the base class.
1. Assignment
In this case the name for the assignment procedure is constructed by the word Assign followed the name of the type that owns the property and finally the name of the property. Some predefined procedures can demonstrate this naming convention:
For example bitmap data can be assigned to the Glyph property of a TSpeedButton with AssignTBitmapData.
void AssignTBitmapData(TSpeedButton* xp, const System::DynamicArray<System::Byte>& xBytes)
Remark: Not the property itself is passed to the procedure, but it's parent, because the property might not exist at runtime.
By use of this function the following DFM code:
Object LineButton: TSpeedButton ... Glyph.Data = { 66010000424D6601000000000000760000002800000014000000140000000100 ...
will be converted to:
LineButton = new TSpeedButton(Panel1); ... AssignTBitmapData(LineButton, { 0x66,0x01,0x00,0x00,0x42,0x4D,0x66,0x01,0x00,0x00 ...
2. Creation / Modification
A creation function is constructed by the word Create followed by the name of the type of the parent of the new variable finally followed by the name of the child variable type..Again, some predefined functions can demonstrate this naming convention:
These creation functions return the type of the new child. For example a new menu item in the main menu will be created with:
TMenuItem* CreateTMainMenuTMenuItem(TMainMenu* xp);
By use of this function the following dfm code:
Object MainMenu1: TMainMenu ... Object File1: TMenuItem ...
will be converted to:
MainMenu1 = new TMainMenu(this); ... File1 = CreateTMainMenuTMenuItem(MainMenu1); ...
3. Item
Collection items can be assigned by means of functions, whose names are constructed from the prefix Get, followed by the name of the collection and the word item. Such a predefined getter function is:
TFieldDef* GetTFieldDefsitem(TFieldDefs* xp, int xiIndex)
4. Event
An event procedure is constructed by the prefix On followed by the name of the type for which this event shall be executed, finally followed by the type of event. A variable of that type will be passed as parameter.Four event procedures are predefined: Two kinds of events can be defined
1. the Begin-event will be executed when a new Control will be created or modified 1. the End-event will be executed after the properties of the Contorl are set.
Four such event procedures are predefined:
|
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |