Script.AddUserCursor(Name[, Table])
Script.AddUserCursor(Name) creates a new cursor with a user defined name. Cursors can be used with DataTables from both the form events and the Grid Script. Providing an optional data table name will pull that data table's data into your user cursor with your cursor name.
Note: This method has been developed so that it should not conflict with system cursors.
Applies To
Properties and Methods
None
Available
The .AddUserCursor(Name[, Table]) method is available in:
- 17.01.006
- All newer builds
Type
Boolean
Syntax
Script.AddUserCursor(Name[, Table]);
Parameters
|
Parameter |
Required |
Description |
|---|---|---|
|
Name |
Yes |
The name of the cursor you will create. Cursor names shall begin with u or s to indicate these are user-defined or scripted |
|
Table |
No |
An optional data table on which to base the cursor. |
Example
//--Script 1:
Script.AddUserCursor("sTomCursor");
var loTable = Script.GetDataTable("sTomCursor");
loTable.AddIntegerColumn("sId");
loTable.AddStringColumn("sText");
loTable.AddDecimalColumn("sValue");
loTable.AddDateTimeColumn("sWhen");
loTable.AddBooleanColumn("SFlag");
var lrData = loTable.AddRow("sId");
lrData.SetString("sText", "Hello World");
lrData.SetDecimal("sValue", Math.PI);
lrData.SetDateTime("sWhen", DateTime.Now);
lrData.SetBoolean("sFlag", false);
Event.Form.ShowDataTable(loTable);
//--Script 2: (Could be on any other form or same form layout)
var loTab = Script.GetDataTable("sTomCursor");
Event.Form.ShowDataTable(loTab);
/* Verify -
1. In DEACOM - Go to the Form Layout with button 1 and 2.
2. Click button 1, confirm that the DataTable with the user defined cursor is displayed.
3. Click button 2, confirm that a DataTable with the same user defined cursor from step 1 is displayed.
*/