Type | Description | |||
Itm as Item | An Item object being clicked. |
The SelectItem event notifies your application once the user clicks/selects an item. The ID property specifies the item's identifier. In C++ or VFP, you can use the Notifier to get notified through the WM_COMMAND message.
Syntax for SelectItem event, /NET version, on:
private void SelectItem(object sender,exontrol.EXRIBBONLib.Item Itm) { } Private Sub SelectItem(ByVal sender As System.Object,ByVal Itm As exontrol.EXRIBBONLib.Item) Handles SelectItem End Sub |
private void SelectItem(object sender, AxEXRIBBONLib._IRibbonEvents_SelectItemEvent e) { } void OnSelectItem(LPDISPATCH Itm) { } void __fastcall SelectItem(TObject *Sender,Exribbonlib_tlb::IItem *Itm) { } procedure SelectItem(ASender: TObject; Itm : IItem); begin end; procedure SelectItem(sender: System.Object; e: AxEXRIBBONLib._IRibbonEvents_SelectItemEvent); begin end; begin event SelectItem(oleobject Itm) end event SelectItem Private Sub SelectItem(ByVal sender As System.Object, ByVal e As AxEXRIBBONLib._IRibbonEvents_SelectItemEvent) Handles SelectItem End Sub Private Sub SelectItem(ByVal Itm As EXRIBBONLibCtl.IItem) End Sub Private Sub SelectItem(ByVal Itm As Object) End Sub LPARAMETERS Itm PROCEDURE OnSelectItem(oRibbon,Itm) RETURN |
<SCRIPT EVENT="SelectItem(Itm)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function SelectItem(Itm) End Function </SCRIPT> Procedure OnComSelectItem Variant llItm Forward Send OnComSelectItem llItm End_Procedure METHOD OCX_SelectItem(Itm) CLASS MainDialog RETURN NIL void onEvent_SelectItem(COM _Itm) { } function SelectItem as v (Itm as OLE::Exontrol.Ribbon.1::IItem) end function function nativeObject_SelectItem(Itm) return |
The following samples show how you can get notified once the user clicks the item:
VBA (MS Access, Excell...)
' SelectItem event - Occurs when the user selects the item. Private Sub Ribbon1_SelectItem(ByVal Itm As Object) With Ribbon1 Debug.Print( "SelectItem event on Itm object" ) End With End Sub With Ribbon1 With .Items .Add "Item" .Add "Item" End With .Refresh End With
VB6
' SelectItem event - Occurs when the user selects the item. Private Sub Ribbon1_SelectItem(ByVal Itm As EXRIBBONLibCtl.IItem) With Ribbon1 Debug.Print( "SelectItem event on Itm object" ) End With End Sub With Ribbon1 With .Items .Add "Item" .Add "Item" End With .Refresh End With
VB.NET
' SelectItem event - Occurs when the user selects the item. Private Sub Exribbon1_SelectItem(ByVal sender As System.Object,ByVal Itm As exontrol.EXRIBBONLib.Item) Handles Exribbon1.SelectItem With Exribbon1 Debug.Print( "SelectItem event on Itm object" ) End With End Sub With Exribbon1 With .Items .Add("Item") .Add("Item") End With .Refresh() End With
VB.NET for /COM
' SelectItem event - Occurs when the user selects the item. Private Sub AxRibbon1_SelectItem(ByVal sender As System.Object, ByVal e As AxEXRIBBONLib._IRibbonEvents_SelectItemEvent) Handles AxRibbon1.SelectItem With AxRibbon1 Debug.Print( "SelectItem event on Itm object" ) End With End Sub With AxRibbon1 With .Items .Add("Item") .Add("Item") End With .Refresh() End With
C++
// SelectItem event - Occurs when the user selects the item. void OnSelectItemRibbon1(LPDISPATCH Itm) { /* Copy and paste the following directives to your header file as it defines the namespace 'EXRIBBONLib' for the library: 'ExRibbon 1.0 Control Library' #import <ExRibbon.dll> using namespace EXRIBBONLib; */ EXRIBBONLib::IRibbonPtr spRibbon1 = GetDlgItem(IDC_RIBBON1)->GetControlUnknown(); OutputDebugStringW( L"SelectItem event on Itm object" ); } EXRIBBONLib::IRibbonPtr spRibbon1 = GetDlgItem(IDC_RIBBON1)->GetControlUnknown(); EXRIBBONLib::IItemsPtr var_Items = spRibbon1->GetItems(); var_Items->Add(L"Item",vtMissing,vtMissing); var_Items->Add(L"Item",vtMissing,vtMissing); spRibbon1->Refresh();
C++ Builder
// SelectItem event - Occurs when the user selects the item. void __fastcall TForm1::Ribbon1SelectItem(TObject *Sender,Exribbonlib_tlb::IItem *Itm) { OutputDebugString( L"SelectItem event on Itm object" ); } Exribbonlib_tlb::IItemsPtr var_Items = Ribbon1->Items; var_Items->Add(L"Item",TNoParam(),TNoParam()); var_Items->Add(L"Item",TNoParam(),TNoParam()); Ribbon1->Refresh();
C#
// SelectItem event - Occurs when the user selects the item. private void exribbon1_SelectItem(object sender,exontrol.EXRIBBONLib.Item Itm) { System.Diagnostics.Debug.Print( "SelectItem event on Itm object" ); } //this.exribbon1.SelectItem += new exontrol.EXRIBBONLib.exg2antt.SelectItemEventHandler(this.exribbon1_SelectItem); exontrol.EXRIBBONLib.Items var_Items = exribbon1.Items; var_Items.Add("Item",null,null); var_Items.Add("Item",null,null); exribbon1.Refresh();
JScript/JavaScript
<BODY onload='Init()'> <SCRIPT FOR="Ribbon1" EVENT="SelectItem(Itm)" LANGUAGE="JScript"> alert( "SelectItem event on Itm object" ); </SCRIPT> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="Ribbon1"></OBJECT> <SCRIPT LANGUAGE="JScript"> function Init() { var var_Items = Ribbon1.Items; var_Items.Add("Item",null,null); var_Items.Add("Item",null,null); Ribbon1.Refresh(); } </SCRIPT> </BODY>
VBScript
<BODY onload='Init()'> <SCRIPT LANGUAGE="VBScript"> Function Ribbon1_SelectItem(Itm) With Ribbon1 alert( "SelectItem event on Itm object" ) End With End Function </SCRIPT> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="Ribbon1"></OBJECT> <SCRIPT LANGUAGE="VBScript"> Function Init() With Ribbon1 With .Items .Add "Item" .Add "Item" End With .Refresh End With End Function </SCRIPT> </BODY>
C# for /COM
// SelectItem event - Occurs when the user selects the item. private void axRibbon1_SelectItem(object sender, AxEXRIBBONLib._IRibbonEvents_SelectItemEvent e) { System.Diagnostics.Debug.Print( "SelectItem event on Itm object" ); } //this.axRibbon1.SelectItem += new AxEXRIBBONLib._IRibbonEvents_SelectItemEventHandler(this.axRibbon1_SelectItem); EXRIBBONLib.Items var_Items = axRibbon1.Items; var_Items.Add("Item",null,null); var_Items.Add("Item",null,null); axRibbon1.Refresh();
X++ (Dynamics Ax 2009)
// SelectItem event - Occurs when the user selects the item. void onEvent_SelectItem(COM _Itm) { ; print( "SelectItem event on Itm object" ); } public void init() { COM com_Items; anytype var_Items; ; super(); var_Items = exribbon1.Items(); com_Items = var_Items; com_Items.Add("Item"); com_Items.Add("Item"); exribbon1.Refresh(); }
Delphi 8 (.NET only)
// SelectItem event - Occurs when the user selects the item. procedure TWinForm1.AxRibbon1_SelectItem(sender: System.Object; e: AxEXRIBBONLib._IRibbonEvents_SelectItemEvent); begin with AxRibbon1 do begin OutputDebugString( 'SelectItem event on Itm object' ); end end; with AxRibbon1 do begin with Items do begin Add('Item',Nil,Nil); Add('Item',Nil,Nil); end; Refresh(); end
Delphi (standard)
// SelectItem event - Occurs when the user selects the item. procedure TForm1.Ribbon1SelectItem(ASender: TObject; Itm : IItem); begin with Ribbon1 do begin OutputDebugString( 'SelectItem event on Itm object' ); end end; with Ribbon1 do begin with Items do begin Add('Item',Null,Null); Add('Item',Null,Null); end; Refresh(); end
VFP
*** SelectItem event - Occurs when the user selects the item. *** LPARAMETERS Itm with thisform.Ribbon1 DEBUGOUT( "SelectItem event on Itm object" ) endwith with thisform.Ribbon1 with .Items .Add("Item") .Add("Item") endwith .Refresh endwith
dBASE Plus
/* with (this.ACTIVEX1.nativeObject) SelectItem = class::nativeObject_SelectItem endwith */ // Occurs when the user selects the item. function nativeObject_SelectItem(Itm) local oRibbon oRibbon = form.Activex1.nativeObject ? "SelectItem event on Itm object" return local oRibbon,var_Items oRibbon = form.Activex1.nativeObject var_Items = oRibbon.Items var_Items.Add("Item") var_Items.Add("Item") oRibbon.Refresh()
XBasic (Alpha Five)
' Occurs when the user selects the item. function SelectItem as v (Itm as OLE::Exontrol.Ribbon.1::IItem) Dim oRibbon as P oRibbon = topparent:CONTROL_ACTIVEX1.activex ? "SelectItem event on Itm object" end function Dim oRibbon as P Dim var_Items as P oRibbon = topparent:CONTROL_ACTIVEX1.activex var_Items = oRibbon.Items var_Items.Add("Item") var_Items.Add("Item") oRibbon.Refresh()
Visual Objects
METHOD OCX_Exontrol1SelectItem(Itm) CLASS MainDialog // SelectItem event - Occurs when the user selects the item. OutputDebugString(String2Psz( "SelectItem event on Itm object" )) RETURN NIL local var_Items as IItems var_Items := oDCOCX_Exontrol1:Items var_Items:Add("Item",nil,nil) var_Items:Add("Item",nil,nil) oDCOCX_Exontrol1:Refresh()
PowerBuilder
/*begin event SelectItem(oleobject Itm) - Occurs when the user selects the item.*/ /* OleObject oRibbon oRibbon = ole_1.Object MessageBox("Information",string( "SelectItem event on Itm object" )) */ /*end event SelectItem*/ OleObject oRibbon,var_Items oRibbon = ole_1.Object var_Items = oRibbon.Items var_Items.Add("Item") var_Items.Add("Item") oRibbon.Refresh()
Visual DataFlex
// Occurs when the user selects the item. Procedure OnComSelectItem Variant llItm Forward Send OnComSelectItem llItm Showln "SelectItem event on Itm object" End_Procedure Procedure OnCreate Forward Send OnCreate Variant voItems Get ComItems to voItems Handle hoItems Get Create (RefClass(cComItems)) to hoItems Set pvComObject of hoItems to voItems Get ComAdd of hoItems "Item" Nothing Nothing to Nothing Get ComAdd of hoItems "Item" Nothing Nothing to Nothing Send Destroy to hoItems Send ComRefresh End_Procedure
XBase++
PROCEDURE OnSelectItem(oRibbon,Itm) DevOut( "SelectItem event on Itm object" ) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oItems LOCAL oRibbon oForm := XbpDialog():new( AppDesktop() ) oForm:drawingArea:clipChildren := .T. oForm:create( ,,{100,100}, {640,480},, .F. ) oForm:close := {|| PostAppEvent( xbeP_Quit )} oRibbon := XbpActiveXControl():new( oForm:drawingArea ) oRibbon:CLSID := "Exontrol.Ribbon.1" /*{DDF58CFA-750F-45E0-8A00-CFBE431702E2}*/ oRibbon:create(,, {10,60},{610,370} ) oRibbon:SelectItem := {|Itm| OnSelectItem(oRibbon,Itm)} /*Occurs when the user selects the item.*/ oItems := oRibbon:Items() oItems:Add("Item") oItems:Add("Item") oRibbon:Refresh() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN