Sub OnGetNodeImage(Sender: Object; Args: IDimensionNodeGetImageEventArgs);
Begin
//set of operators;
End Sub OnGetNodeImage;
Sender. The parameter that returns the component that generated the event.
Args. The parameter that enables the user to determine event parameters.
The OnGetNodeImage event is used on determining an image near the tree element.
The event is relevant if the Images property is determined for the component.
The event occurs for each tree element in the following cases:
Form parameters are changed: size, state.
Form contents is updated.
Component parameters are changed: element list is changed, hierarchy is collapsed/expanded, element selection or focus is changed.
Element tree is scrolled.
Component contents is updated.
Using the OnGetNodeImage event enables the user to trace changes and, if a certain event occurs, to get of change element tree image. Index of the element, for which the current event is generated, is available in the Node property of the Args event argument. The ImageIndex property of event argument can be used to get index of the image that is set for element. If a new value is specified for the ImageIndex property, element image can be changed.
Executing the example requires a form, the DimensionTree named DimensionTree1 on the form, the UiDimension component that is data source for DimensionTree1, and the ImageList component containing a set of images. ImageList is set in the Images property for the DimensionTree1 component. UiDimensionis connected to a dictionary. The following procedure is implemented as the OnGetNodeImage event handler for the DimensionTree1 component.
Sub DimensionTree1OnGetNodeImage(Sender: Object; Args: IDimensionNodeGetImageEventArgs);
Begin
Select Case Args.State
Case DimensionViewerNodeState.None: Args.ImageIndex := -1;
Case DimensionViewerNodeState.Selected: Args.ImageIndex := 0;
Case DimensionViewerNodeState.Focused: Args.ImageIndex := 1;
Case DimensionViewerNodeState.SelectedFocused: Args.ImageIndex := 2;
Case DimensionViewerNodeState.Expanded: Args.ImageIndex := 3;
End Select;
End Sub DimensionTree1OnGetNodeImage;
On occurring the event of the element, for which the event was generated, the corresponding image is set according to the element state.
See also: