Each of our component comes with the eXHelper
tool that helps you to generate source code for different HOW-TO questions.
Usually, the tool goes to C:\Program Files\Exontrol\<COMPONENT>
folder, with the name ExHelper.
Run the eXHelper tool
If case, select the component from the upper-left field. By default,
the component from the folder you run the tool, is loaded.
Select a question, and double click it
The Middle/Template panel will show you the x-script
code, while the Right/Running Panel will show the component after
running the x-script code
Right-Click Middle/Template panel, and select the
Convert To ...
Choose the dBASE Plus, and the Middle/Template
displays the dBASE Plus source code, which you can copy and paste to your form's code
Here's a few movie on how to:
Generating Source Code using the eXHelper tool
Spying objects of the browsed component using the eXHelper tool
The following screen shot shows the eXHelper
tool with main parts:
In other words, you can use the Template
/ TemplatePut
/ TemplateDef property to call or change any
control's property with one or more parameters.
any property-get with one or more parameters should be stored as local variable.
For instance, Color
property changes the visual appearance of the specified bar,
so the code
oG2antt.Chart.Bars.Item("Task").Color = 0xff
should be translated to
local oBar
oBar = oG2antt.Chart.Bars.Item("Task")
oBar.Color = 0xff
In other words, you can use the Template
/ TemplatePut
/ TemplateDef property to call or change any
control's property with one or more parameters.
during an event, no other event can occur.
For instance, Timer
property occurs every specified interval,
so during the event no other events can be fired. For instance, you
change the layer's Value property which should invoke the Change
event, but it won't be called. In order to prevent that you have to call directly
the event's handler as follow.
The code adds two columns, with partial-check feature, and two items, so
the code is compiled fine, but at runtime, the partial check will not shown,
as it shows in the eXHelper
tool
In this case, the missing property is TemplateDef, and dBASE
is not firing any exception as it is missing. This is mostly happen because
you are using an older version of the component that provides no TemplateDef
property. Newer versions provides Template, TemplateDef, TemplatePut and
ExecuteTemplate methods.
For instance, here's how you can find out if the component you
have installed, has the TemplateDef property:
Run the eXHelper tool
If case, select the component from the upper-left field. By default,
the component from the folder you run the tool, is loaded.
In the Middle/Template panel, remove all text, and paste the following
code:
TemplateDef = "BackColor = 0"
Press the CTRL + R, to execute the code, or waits longer
If no error occurs, it means that your component provides
implementation for TemplateDef property
If an error occurs, it means that the control provides no
implementation for TemplateDef property as you can see it bellow:
Unfortunately, dBASE Plus can not handle properties or methods with multiple
parameters. In other words, once a property or method with parameters
returns an object, after that no property / method of returned object will
be known.
For instance the following code, adds a new hidden column:
oGrid.Columns.Add("Hidden").Visible = false
it is compiled just fine, but the result is not what we expect. The
column is shown, as it should be hidden ( Visible = False )
and the result is what we want, a new hidden column.
Fortunately, we have the solution for this, as our controls support
TemplateDef, Template and ExecuteTemplate properties, which helps you to
call any of the control's property/method with or without parameters using
our x-script code,
that's built to be easy to use.
Most of our components provides the following properties:
TemplateDef property, define the variables to be used in the
next Template or ExecuteTemplate call. The first call of TemplateDef
property should be "dim <variables>" where
<variables> defines the n-variables ( separated by comma character
) to be used in the next call of Template or ExecuteTemplate property.
The next n-calls of TemplateDef property defines the variable one by one
as you listed in the first call of TemplateDef . For instance TemplateDef =
"dim a,b"; TemplateDef = 255; TemplateDef =
"default", defines two variables named a with
the value 255 and b with the value as string "default"so
a and b variables are known for next Template / ExecuteTemplate calls.
For instance, if next you call Template = "Columns.Add(b).Def(7) =
a" adds a new column with the caption "default",
and it's header background color (Column.Def(7) property) to Red ( 255 ).
Template property, executes the x-script code.
For instance, Template = [Columns{Add("Column 1"){DisplayFilterButton = True};Add("Column 2"){DisplayFilterButton =
True}}], adds two columns, each with the DisplayFilterButton
property set on True.
ExecuteTemplate property, executes the code, and returns the
result. For instance, ? ExecuteTemplate("Columns.Count()"),
executes the Columns.Count() x-script, and gets the result, in this case
gets the number of columns.
Any of these properties accept x-script
code, which is a simple way of calling control/object's properties, methods/events using strings. Exontrol owns the x-script implementation in its easiest way and it does not require any VB,
... engine to get executed. The eXHelper
tool uses x-script and provides tons of how-to questions that can be
converted to your programming languages. The same way the entire
Template/x-script code from the eXHelper
can be copied to a single line and pass it to the control's Template
property like in the following sample:
Run the eXHelper tool
Select any question in the left panel, and double-click it or press
CTRL + S, so the right/running panel, shows the changes in the control
Right-Click the Middle/Template panel, and select "Copy To Single
Line"
The eXHelper is minimized, and your clipboard contains the entire
Template/x-script code, which you can paste to any Template call as
shown in the next sample:
For instance, insert the eXGrid to a form, and paste the following code (
which uses Template property only ):
function form_onOpen()
local oGrid
oGrid = form.EXGRIDACTIVEXCONTROL1.nativeObject
oGrid.Template = [BeginUpdate();Dim rs;Appearance = 0;ColumnAutoResize = False;rs = CreateObject(`ADOR.Recordset`);{;Open(`Orders`,`Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\SAMPLE.MDB`, 3, 3 );};DataSource = rs;SortBarVisible = True;SortBarCaption = `Drag a <b>column</b> header here to group by that column.`;AllowGroupBy = True;Columns(0).Width = 96;Layout = `multiplesort="C1:2 C5:1";singlesort=C0:1`;BackColorSortBar =
RGB(240,240,240);EndUpdate()]
return
and you should get a picture like follows:
Still, we do NOT recommend using long strings for Template
properties, as it is hard to follow, in case something is not working as it
should.
Get a Specific Table Field Value on the current item selected ? [Using the FieldName, and assuming that the Column key attribute has been set to it.] Of course, It can still be achieved using the column index (?columns.item(2)), the maintenance of this type of coding can be time consuming if the grid structure changes.
local oGrid, cFieldName, nCurItem, nColIndex, cFieldValue, cStr
oGrid = form.EXGRIDACTIVEXCONTROL1.nativeObject
cFieldName=?employeID?
nCurItem=oGrid.ExecuteTemplate("items.selectedItem()")
cFieldName=cFieldName.leftTrim().rightTrim().toLowerCase()
cStr=[columns.item("] + cFieldName + [").index]
nColIndex=oGrid.ExecuteTemplate(cStr) //Get the column Index based on the fieldname (previously set as a key)
cStr=[items.cellValue(] + nCurItem + [,] + nColIndex + [)]
cFieldValue=oGrid.ExecuteTemplate(cStr)
This can be built as function with FieldName as parameter and can be called whenever necessary.
The most probably this is happen because dBASE PLUS is not able to handle
runtime-licensed controls ( IClassFactory2 ).
If this error is happening with any controls you purchased from us,
please contact
us ASAP and provide the following information:
Company
Address
City
Country
Based on the information you provide we will build and send you a new
update that includes the runtime-less version of the component, that can be
used on your dBASE PLUS environment, free of charge. The new update includes the
information you provided in the License page of the DLL, as you can see
bellow:
Generally, all events are fired as they were designed. Sometime, it may be possible that during an event other events to be invoked. Due limitation of dBASE Plus language, during an event, no other event can occur.
Please follow the next steps to add a Event notification, that occurs every
internal event that the control fires:
Select the component in design mode, and select the nativeObject from the
Inspector
Choose the Events page
Locate and select the item named Event, and add a handler for it
Adds the code:
function nativeObject_Event(EventID)
?form.EXG2ANTTCHARTACTIVEXCONTROL1.nativeObject.EventParam(-2)
return
Save and Run the project. This code uses the Event
and EventParam
to display information about events the control fires.
Once you make changes into the control, the Command panel will display information like follows:
For instance, Timer
property occurs every specified interval,
so during the event no other events can be fired. For instance, you
change the layer's Value property which should invoke the Change
event, but it won't be called. In order to prevent that you have to call directly
the event's handler as follow.
When you are trying to run any of installed samples, you may encounter the
Access Denied error. This is happening because you do not have read-write access
to that folder / files.
In order to prevent that you can do any of the following:
Run the dBASE Plus application as an Administrator
Copy / Move the samples to another folder when you have read-write
access.
This error occurs for any program, it is not related to the component or to the environment itself.