event UserEditorOleEvent (Object as Object, Ev as OleEvent, CloseEditor as Boolean, Node as Node)
Occurs when an user editor fires an event.

 TypeDescription 
   Object as Object An object created by UserEditor property.  
   Ev as OleEvent An OleEvent object that holds information about the event   
   CloseEditor as Boolean A boolean expression that indicates whether the control should close the user editor.  
   Node as Node A Node object where the ActiveX editor is opened.   
The UserEditorOleEvent is fired every time when an user editor object fires an event. The information about fired event is stored by Ev parameter. The CloseEditor parameter is useful to inform the control when the editor should be hidden. The UserEditorOpen event is fired when the control shows an ActiveX editor. The control fires the UserEditorClose event when the user closes the ActiveX editor ( for instance, when he clicks outside the editing node ). Use the Add method and UserEditorType type to add an ActiveX editor to the control. Use the UserEditor method to create an ActiveX editor. Use the UserEditorObject property to get the ActiveX editor created by the UserEditor method.

The following VB sample closes the Exontrol's ExComboBox user editor when the user selects a new value, or when it presses the Escape key. Also the sample changes the value of the node in the ExComboBox control:

Private Sub XMLGrid1_UserEditorOleEvent(ByVal Object As Object, ByVal Ev As EXMLGRIDLibCtl.IOleEvent, CloseEditor As Boolean, ByVal Node As EXMLGRIDLibCtl.INode)
    If (Ev.Name = "Change") Then
        Node.Value = Object.Select(0)
        CloseEditor = True
    End If
    
    If (Ev.Name = "KeyPress") Then
        Dim l As Long
        l = Ev(0).Value
        If l = vbKeyEscape Then
            CloseEditor = True
        End If
    End If
End Sub

the sample requires an ActiveX editor ( in our case the Exontrol's ExComboBox control ):

The following C++ sample closes the Exontrol's ExComboBox user editor when the user selects a new value, or when it presses the Escape key. Also the sample changes the value of the node in the ExComboBox control:

#import <exmlgrid.dll>
#import <excombobox.dll>
void OnUserEditorOleEventXmlgrid1(LPDISPATCH Object, LPDISPATCH Ev, BOOL FAR* CloseEditor, LPDISPATCH Node) 
{
	EXMLGRIDLib::IOleEventPtr spEvent = Ev;
	EXCOMBOBOXLib::IComboBoxPtr spComboBox = Object;
	if ( spComboBox != NULL )
		if ( spEvent != NULL  )
		{
			if ( spEvent->Name.operator ==( "Change" ) )
			{
				CNode node( Node );
				node.SetValue( spComboBox->GetSelect( COleVariant( (long)0 ) ) );
				*CloseEditor = TRUE;
			}
			else
				if ( spEvent->Name.operator ==( "KeyPress" ) )
				{
					// gets the KeyCode parameter
					EXMLGRIDLib::IOleEventParamPtr spParam;
					if ( SUCCEEDED( spEvent->get_Param( COleVariant( (long)0 ), &spParam ) ) )
					{
						COleVariant vtI4;
						vtI4.ChangeType( VT_I4, &spParam->Value );
						if ( V_I4( &vtI4) == VK_ESCAPE )
							*CloseEditor = TRUE;
					}
				}
		}
}

the sample requires an ActiveX editor ( in our case the Exontrol's ExComboBox control ), so we need to call the #import <excombobox.dll> in order to include definitions for objects and types in the ExComboBox control. The #import <excombobox.dll> creates EXCOMBOBOXLib namespace that includes all definitions for objects and types that the ExComboBox control exports.

The following VB.NET sample closes the Exontrol's ExComboBox user editor when the user selects a new value, or when it presses the Escape key. Also the sample changes the value of the node in the ExComboBox control:

Private Sub AxXMLGrid1_UserEditorOleEvent(ByVal sender As Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_UserEditorOleEventEvent) Handles AxXMLGrid1.UserEditorOleEvent
    If (e.ev.Name = "Change") Then
        e.node.Value = e.object.Select(0)
        e.closeEditor = True
    End If

    If (e.ev.Name = "KeyPress") Then
        Dim l As Integer = e.ev(0).Value
        If l = Keys.Escape Then
            e.closeEditor = True
        End If
    End If
End Sub

the sample requires an ActiveX editor ( in our case the Exontrol's ExComboBox control ):

The following C# sample closes the Exontrol's ExComboBox user editor when the user selects a new value, or when it presses the Escape key. Also the sample changes the value of the node in the ExComboBox control:

private void axXMLGrid1_UserEditorOleEvent(object sender, AxEXMLGRIDLib._IXMLGridEvents_UserEditorOleEventEvent e)
{
	if (e.ev.Name == "Change")
	{
		EXCOMBOBOXLib.ComboBox comboBox = e.@object as EXCOMBOBOXLib.ComboBox;
		if ( comboBox != null )
			e.node.Value = comboBox.get_Select(0);
		e.closeEditor = true;
	}
	else
		if (e.ev.Name == "KeyPress")
		{
			if (Convert.ToInt16(e.ev[0].Value) == Convert.ToInt16(Keys.Escape))
				e.closeEditor = true;
		}
}

the sample requires an ActiveX editor ( in our case the Exontrol's ExComboBox control ):

In C# your project needs a new reference to the Exontrol's ExComboBox control library. Use the Project\Add Reference\COM item to add new reference to a COM object. Once that you added a reference to the Exontrol's ExComboBox the EXCOMBOBOXLib namespace is created. The EXCOMBOBOXLib namespace contains definitions for all objects that ExComboBox control exports.

The following VFP sample closes the Exontrol's ExComboBox user editor when the user selects a new value, or when it presses the Escape key. Also the sample changes the value of the node in the ExComboBox control:

*** ActiveX Control Event ***
LPARAMETERS object, ev, closeeditor, node

If (ev.Name = "Change") Then
    node.Value = object.Select(0)
    closeeditor = .t.
else
	If (ev.Name = "KeyPress") Then
	    local l
	    l = Ev(0).Value
	    If l = 27 Then
	        closeeditor = .t.
	    EndIf
	EndIf
EndIf

the sample requires an ActiveX editor ( in our case the Exontrol's ExComboBox control ):


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.