Type | Description | |||
Boolean | A Boolean expression that specifies whether the control is locked or unlocked. |
How can I lock the control, so no events occur, but no shown in gray as Enabled do?
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 should not be fired while locked" ) End With End Sub With Ribbon1 .Locked = True With .Items .Add("Disabled").Enabled = False .Add "Item 2" .Add "Item 3" 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 should not be fired while locked" ) End With End Sub With Ribbon1 .Locked = True With .Items .Add("Disabled").Enabled = False .Add "Item 2" .Add "Item 3" 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 should not be fired while locked" ) End With End Sub With Exribbon1 .Locked = True With .Items .Add("Disabled").Enabled = False .Add("Item 2") .Add("Item 3") 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 should not be fired while locked" ) End With End Sub With AxRibbon1 .Locked = True With .Items .Add("Disabled").Enabled = False .Add("Item 2") .Add("Item 3") 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 should not be fired while locked" ); } EXRIBBONLib::IRibbonPtr spRibbon1 = GetDlgItem(IDC_RIBBON1)->GetControlUnknown(); spRibbon1->PutLocked(VARIANT_TRUE); EXRIBBONLib::IItemsPtr var_Items = spRibbon1->GetItems(); var_Items->Add(L"Disabled",vtMissing,vtMissing)->PutEnabled(VARIANT_FALSE); var_Items->Add(L"Item 2",vtMissing,vtMissing); var_Items->Add(L"Item 3",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 should not be fired while locked" ); } Ribbon1->Locked = true; Exribbonlib_tlb::IItemsPtr var_Items = Ribbon1->Items; var_Items->Add(L"Disabled",TNoParam(),TNoParam())->Enabled = false; var_Items->Add(L"Item 2",TNoParam(),TNoParam()); var_Items->Add(L"Item 3",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 should not be fired while locked" ); } //this.exribbon1.SelectItem += new exontrol.EXRIBBONLib.exg2antt.SelectItemEventHandler(this.exribbon1_SelectItem); exribbon1.Locked = true; exontrol.EXRIBBONLib.Items var_Items = exribbon1.Items; var_Items.Add("Disabled",null,null).Enabled = false; var_Items.Add("Item 2",null,null); var_Items.Add("Item 3",null,null); exribbon1.Refresh();
JScript/JavaScript
<BODY onload='Init()'> <SCRIPT FOR="Ribbon1" EVENT="SelectItem(Itm)" LANGUAGE="JScript"> alert( "SelectItem should not be fired while locked" ); </SCRIPT> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="Ribbon1"></OBJECT> <SCRIPT LANGUAGE="JScript"> function Init() { Ribbon1.Locked = true; var var_Items = Ribbon1.Items; var_Items.Add("Disabled",null,null).Enabled = false; var_Items.Add("Item 2",null,null); var_Items.Add("Item 3",null,null); Ribbon1.Refresh(); } </SCRIPT> </BODY>
VBScript
<BODY onload='Init()'> <SCRIPT LANGUAGE="VBScript"> Function Ribbon1_SelectItem(Itm) With Ribbon1 alert( "SelectItem should not be fired while locked" ) End With End Function </SCRIPT> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="Ribbon1"></OBJECT> <SCRIPT LANGUAGE="VBScript"> Function Init() With Ribbon1 .Locked = True With .Items .Add("Disabled").Enabled = False .Add "Item 2" .Add "Item 3" 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 should not be fired while locked" ); } //this.axRibbon1.SelectItem += new AxEXRIBBONLib._IRibbonEvents_SelectItemEventHandler(this.axRibbon1_SelectItem); axRibbon1.Locked = true; EXRIBBONLib.Items var_Items = axRibbon1.Items; var_Items.Add("Disabled",null,null).Enabled = false; var_Items.Add("Item 2",null,null); var_Items.Add("Item 3",null,null); axRibbon1.Refresh();
X++ (Dynamics Ax 2009)
// SelectItem event - Occurs when the user selects the item. void onEvent_SelectItem(COM _Itm) { ; print( "SelectItem should not be fired while locked" ); } public void init() { COM com_Item,com_Items; anytype var_Item,var_Items; ; super(); exribbon1.Locked(true); var_Items = exribbon1.Items(); com_Items = var_Items; var_Item = COM::createFromObject(com_Items.Add("Disabled")); com_Item = var_Item; com_Item.Enabled(false); com_Items.Add("Item 2"); com_Items.Add("Item 3"); 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 should not be fired while locked' ); end end; with AxRibbon1 do begin Locked := True; with Items do begin Add('Disabled',Nil,Nil).Enabled := False; Add('Item 2',Nil,Nil); Add('Item 3',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 should not be fired while locked' ); end end; with Ribbon1 do begin Locked := True; with Items do begin Add('Disabled',Null,Null).Enabled := False; Add('Item 2',Null,Null); Add('Item 3',Null,Null); end; Refresh(); end
VFP
*** SelectItem event - Occurs when the user selects the item. *** LPARAMETERS Itm with thisform.Ribbon1 DEBUGOUT( "SelectItem should not be fired while locked" ) endwith with thisform.Ribbon1 .Locked = .T. with .Items .Add("Disabled").Enabled = .F. .Add("Item 2") .Add("Item 3") 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 should not be fired while locked" return local oRibbon,var_Item,var_Items oRibbon = form.Activex1.nativeObject oRibbon.Locked = true var_Items = oRibbon.Items // var_Items.Add("Disabled").Enabled = false var_Item = var_Items.Add("Disabled") with (oRibbon) TemplateDef = [Dim var_Item] TemplateDef = var_Item Template = [var_Item.Enabled = false] endwith var_Items.Add("Item 2") var_Items.Add("Item 3") 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 should not be fired while locked" end function Dim oRibbon as P Dim var_Item as P Dim var_Items as P oRibbon = topparent:CONTROL_ACTIVEX1.activex oRibbon.Locked = .t. var_Items = oRibbon.Items ' var_Items.Add("Disabled").Enabled = .f. var_Item = var_Items.Add("Disabled") oRibbon.TemplateDef = "Dim var_Item" oRibbon.TemplateDef = var_Item oRibbon.Template = "var_Item.Enabled = False" var_Items.Add("Item 2") var_Items.Add("Item 3") oRibbon.Refresh()
Visual Objects
METHOD OCX_Exontrol1SelectItem(Itm) CLASS MainDialog // SelectItem event - Occurs when the user selects the item. OutputDebugString(String2Psz( "SelectItem should not be fired while locked" )) RETURN NIL local var_Items as IItems oDCOCX_Exontrol1:Locked := true var_Items := oDCOCX_Exontrol1:Items var_Items:Add("Disabled",nil,nil):Enabled := false var_Items:Add("Item 2",nil,nil) var_Items:Add("Item 3",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 should not be fired while locked" )) */ /*end event SelectItem*/ OleObject oRibbon,var_Items oRibbon = ole_1.Object oRibbon.Locked = true var_Items = oRibbon.Items var_Items.Add("Disabled").Enabled = false var_Items.Add("Item 2") var_Items.Add("Item 3") oRibbon.Refresh()
Visual DataFlex
// Occurs when the user selects the item. Procedure OnComSelectItem Variant llItm Forward Send OnComSelectItem llItm Showln "SelectItem should not be fired while locked" End_Procedure Procedure OnCreate Forward Send OnCreate Set ComLocked to True Variant voItems Get ComItems to voItems Handle hoItems Get Create (RefClass(cComItems)) to hoItems Set pvComObject of hoItems to voItems Variant voItem Get ComAdd of hoItems "Disabled" Nothing Nothing to voItem Handle hoItem Get Create (RefClass(cComItem)) to hoItem Set pvComObject of hoItem to voItem Set ComEnabled of hoItem to False Send Destroy to hoItem Get ComAdd of hoItems "Item 2" Nothing Nothing to Nothing Get ComAdd of hoItems "Item 3" Nothing Nothing to Nothing Send Destroy to hoItems Send ComRefresh End_Procedure
XBase++
PROCEDURE OnSelectItem(oRibbon,Itm) DevOut( "SelectItem should not be fired while locked" ) 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.*/ oRibbon:Locked := .T. oItems := oRibbon:Items() oItems:Add("Disabled"):Enabled := .F. oItems:Add("Item 2") oItems:Add("Item 3") oRibbon:Refresh() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN