![]() | Type | Description | ||
| Object as Object | An object created by UserEditor property. | |||
| Node as Node | A Node object that hosts an user editor. |
The following VB sample selects an item into an user editor of EXCOMBOBOXLibCtl.ComboBox ( Exontrol's ExComboBox control ) type:
Private Sub XMLGrid1_UserEditorOpen(ByVal Object As Object, ByVal Node As EXMLGRIDLibCtl.INode)
On Error Resume Next
With Object.Items
.SelectItem(.FindItem(Node.Value)) = True
End With
End Sub
The following C++ sample selects an item into an user editor of EXCOMBOBOXLibCtl.ComboBox ( Exontrol's ExComboBox control ) type:
#import <excombobox.dll>
void OnUserEditorOpenXmlgrid1(LPDISPATCH Object, LPDISPATCH Node)
{
COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR;
CNode node( Node ); node.m_bAutoRelease = FALSE;
EXCOMBOBOXLib::IComboBoxPtr spComboBox = Object;
if ( spComboBox != NULL )
{
long nItem = NULL;
EXCOMBOBOXLib::IItemsPtr spItems = spComboBox->Items;
if ( SUCCEEDED( spItems->get_FindItem( node.GetValue(), COleVariant( long(0) ), vtMissing, &nItem ) ) )
spItems->put_SelectItem( nItem, VARIANT_TRUE );
}
}
The sample assumes that the Object parameter holds an ExComboBox control. 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 selects an item into an user editor of EXCOMBOBOXLibCtl.ComboBox ( Exontrol's ExComboBox control ) type:
Private Sub AxXMLGrid1_UserEditorOpen(ByVal sender As Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_UserEditorOpenEvent) Handles AxXMLGrid1.UserEditorOpen
On Error Resume Next
With e.object.Items
.SelectItem(.FindItem(e.node.Value)) = True
End With
End Sub
The following C# sample selects an item into an user editor of EXCOMBOBOXLibCtl.ComboBox ( Exontrol's ExComboBox control ) type:
private void axXMLGrid1_UserEditorOpen(object sender, AxEXMLGRIDLib._IXMLGridEvents_UserEditorOpenEvent e)
{
EXCOMBOBOXLib.ComboBox comboBox = e.@object as EXCOMBOBOXLib.ComboBox;
if (comboBox != null)
{
EXCOMBOBOXLib.Items items = comboBox.Items;
int nItem = items.get_FindItem(e.node.Value, 0, null);
if (nItem != 0)
items.set_SelectItem(nItem, true);
}
}
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 selects an item into an user editor of EXCOMBOBOXLibCtl.ComboBox ( Exontrol's ExComboBox control ) type:
*** ActiveX Control Event *** LPARAMETERS object, node With object.Items .DefaultItem = .FindItem(node.Value,0) if ( .DefaultItem # 0 ) .SelectItem(0) = .t. endif EndWith