Type | Description | |||
newVal as Variant | A string expression that indicates the Dim declaration, or any Object expression to be assigned to previously declared variables. |
So, calling the TemplateDef property should be as follows:
with (Control) TemplateDef = [Dim var_Column] TemplateDef = var_Column Template = [var_Column.Def(4) = 255] endwith
This sample allocates a variable var_Column, assigns the value to the variable ( the second call of the TemplateDef ), and the Template call uses the var_Column variable ( as an object ), to call its Def property with the parameter 4.
Let's say we need to define the background color for a specified column, so we need to call the Def(exCellBackColor) property of the column, to define the color for all cells in the column.
The following VB6 sample shows setting the Def property such as:
With Control .Columns.Add("Column 1").Def(exCellBackColor) = 255 .Columns.Add "Column 2" .Items.AddItem 0 .Items.AddItem 1 .Items.AddItem 2 End With
In dBASE Plus, calling the Def(4) has no effect, instead using the TemplateDef helps you to use properly the Def property as follows:
local Control,var_Column Control = form.Activex1.nativeObject // Control.Columns.Add("Column 1").Def(4) = 255 var_Column = Control.Columns.Add("Column 1") with (Control) TemplateDef = [Dim var_Column] TemplateDef = var_Column Template = [var_Column.Def(4) = 255] endwith Control.Columns.Add("Column 2") Control.Items.AddItem(0) Control.Items.AddItem(1) Control.Items.AddItem(2)
The equivalent sample for XBasic in A5, is as follows:
Dim Control as P Dim var_Column as P Control = topparent:CONTROL_ACTIVEX1.activex ' Control.Columns.Add("Column 1").Def(4) = 255 var_Column = Control.Columns.Add("Column 1") Control.TemplateDef = "Dim var_Column" Control.TemplateDef = var_Column Control.Template = "var_Column.Def(4) = 255" Control.Columns.Add("Column 2") Control.Items.AddItem(0) Control.Items.AddItem(1) Control.Items.AddItem(2)
The samples just call the Column.Def(4) = Value, using the TemplateDef. The first call of TemplateDef property is "Dim var_Column", which indicates that the next call of the TemplateDef will defines the value of the variable var_Column, in other words, it defines the object var_Column. The last call of the Template property uses the var_Column member to use the x-script and so to set the Def property so a new color is being assigned to the column.
The TemplateDef, Template and ExecuteTemplate support x-script language ( Template script of the Exontrols ), like explained bellow:
The Template or x-script is composed by lines of instructions. Instructions are separated by "\n\r" ( newline characters ) or ";" character. The ; character may be available only for newer versions of the components.
An x-script instruction/line can be one of the following:
The x-script may uses constant expressions as follow:
Also , the template or x-script code may support general functions as follows: