.NET Customisation
User Guide
.NET Customisation
:
AVEVA C# Grid Control
: Add an Event to the Addin
Add an Event to the Addin
There are several events which have been exposed for the AVEVA Grid Control. These are:
AfterCellUpdate
No Arguments
Event to alert the user that a cell has been updated.
AfterCellPosChanged
No Arguments
Event to alert the user when a column is dragged to a new position, resized, or un/fixed.
AfterCellSelectChange
No Arguments
Event to alert the user when the cell selection is changed.
AfterRowsDeleted
No Arguments
AfterRowFilterChanged(Array)
•
Array[0] is the tag of the column in which the filter was changed.
Event to alert the user when a column filter is changed.
AfterRowInsert
No Arguments
Event to alert the user that a row has been inserted.
AfterRowUpdate
No Arguments
Event to alert the user that a row has been updated.
AfterSelectChange (Array)
•
Array[0] contains the ID of each of the selected rows
An array of selected items is passed through to the calling application. See the example C# code snippet below. The example code shows that the number of selected items is written to a text box.
private
void
netGridControl1_AfterSelectChange(System.Collections.ArrayLst args)
{
//Print the number of the selected rows in textbox2
if
(args ==
null
)
{
return
;
}
Hashtable al =
new
Hashtable();
al = (Hashtable)args[0];
if
(al ==
null
)
{
return
;
}
this
.textBox2.Text = al.Count.ToString();
}
Refer to
Events
for Event handling.
BeforeCellActivate (Array)
•
Array[0] is the Row Tag of the cell
•
Array[1] is the Column Tag of the cell
BeforeCellUpdate (Array)
•
Array[0] is the new value the user typed in
•
Array[1] is the Row Tag of the cell
•
Array[2] is the Column Tag of the cell
•
Array[3] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[4] is a string. If you set Array[3] to "false" then this value can be set to give the reason why the new value cannot be allowed. The message will be displayed in the cell tooltip.
Cell data is passed back to the calling application as an array before a change is made in a cell of the grid (This assumes that the grid is in editable mode or bulk editable mode). The fourth argument of the array (Array[3]) can be set to false by the calling application in order to disallow the new value of the cell.
Note:
This event is the opportunity for the calling code to make a synchronising change to any related data source. In the case where the related data is Dabacon element/attribute data, the BeforeCellUpdate event should arrange for the Dabacon element/attribute to be modified appropriately. A convenient way to do this is to use the NetGridControl.DoDabaconCellUpdate(Array) function to perform the modification. Simply pass the Array to this function as an argument. If the function is unable to perform the modification for any reason the Array[3] and Array[4] values will be set to indicate the problem.
BeforeRowsDeleted (Array)
•
Array[0] the rows to be deleted
•
Array[1] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[2] is a string. If you set Array[1] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
BeforeRowInsert (Array)
•
Array[0] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[1] is a string. If you set Array[0] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
BeforeRowUpdate(Array)
•
Array[0] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[1] is a string. If you set Array[0] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
CellChange
•
Array[0] is the tag of the row
•
Array[1] is a tag of the column
Event to alert the user when the value of a cell is changed.
ColumnsChanged
This event is fired when the column layout is changed.
ColumnsInGroupByMode (Array)
•
Array[0] is a Boolean. It is true if any columns are in the group by mode.
CopyKeyPressed (Array)
•
Array[0] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[1] is a string. If you set Array[0] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
CutKeyPressed (Array)
•
Array[0] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[1] is a string. If you set Array[0] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
DeleteKeyPressed (Array)
•
Array[0] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[1] is a string. If you set Array[0] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
LayoutChanged
This event is fired when the grid layout is changed.
OnPopup (Array)
•
Array[0] is the x coordinate of the current cursor position
•
Array[1] is the y coordinate of the current cursor position
•
Array[2] contains the ID of each of the selected rows
The position of the mousedown, and an array of selected items is passed through to the calling application when the context menu is used on the grid.
OnDragDropCopy (Array)
•
Array[0] is the row tag of the copied row
•
Array[1] is the drop index
•
Array[2] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[3] is a string. If you set Array[2] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
OnDragDropMove (Array)
•
Array[0] is the row tag of the copied row
•
Array[1] is the drop index
•
Array[2] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[3] is a string. If you set Array[2] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
PasteKeyPressed (Array)
•
Array[0] is a Boolean. If you set it to "false" then the action is cancelled
•
Array[1] is a string. If you set Array[0] to "false" then this value can be set to give the reason why the action has been cancelled. The message will be displayed in the cell tooltip.
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.