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 ToolBar1_SelectItem(ByVal Itm As Object) With ToolBar1 Debug.Print( "SelectItem should not be fired while locked" ) End With End Sub With ToolBar1 .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 ToolBar1_SelectItem(ByVal Itm As EXTOOLBARLibCtl.IItem) With ToolBar1 Debug.Print( "SelectItem should not be fired while locked" ) End With End Sub With ToolBar1 .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 Extoolbar1_SelectItem(ByVal sender As System.Object,ByVal Itm As exontrol.EXTOOLBARLib.Item) Handles Extoolbar1.SelectItem With Extoolbar1 Debug.Print( "SelectItem should not be fired while locked" ) End With End Sub With Extoolbar1 .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 AxToolBar1_SelectItem(ByVal sender As System.Object, ByVal e As AxEXTOOLBARLib._IToolBarEvents_SelectItemEvent) Handles AxToolBar1.SelectItem With AxToolBar1 Debug.Print( "SelectItem should not be fired while locked" ) End With End Sub With AxToolBar1 .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 OnSelectItemToolBar1(LPDISPATCH Itm) { /* Copy and paste the following directives to your header file as it defines the namespace 'EXTOOLBARLib' for the library: 'ExToolBar 1.0 Control Library' #import <ExToolBar.dll> using namespace EXTOOLBARLib; */ EXTOOLBARLib::IToolBarPtr spToolBar1 = GetDlgItem(IDC_TOOLBAR1)->GetControlUnknown(); OutputDebugStringW( L"SelectItem should not be fired while locked" ); } EXTOOLBARLib::IToolBarPtr spToolBar1 = GetDlgItem(IDC_TOOLBAR1)->GetControlUnknown(); spToolBar1->PutLocked(VARIANT_TRUE); EXTOOLBARLib::IItemsPtr var_Items = spToolBar1->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); spToolBar1->Refresh();
C++ Builder
// SelectItem event - Occurs when the user selects the item. void __fastcall TForm1::ToolBar1SelectItem(TObject *Sender,Extoolbarlib_tlb::IItem *Itm) { OutputDebugString( L"SelectItem should not be fired while locked" ); } ToolBar1->Locked = true; Extoolbarlib_tlb::IItemsPtr var_Items = ToolBar1->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()); ToolBar1->Refresh();
C#
// SelectItem event - Occurs when the user selects the item. private void extoolbar1_SelectItem(object sender,exontrol.EXTOOLBARLib.Item Itm) { System.Diagnostics.Debug.Print( "SelectItem should not be fired while locked" ); } //this.extoolbar1.SelectItem += new exontrol.EXTOOLBARLib.exg2antt.SelectItemEventHandler(this.extoolbar1_SelectItem); extoolbar1.Locked = true; exontrol.EXTOOLBARLib.Items var_Items = extoolbar1.Items; var_Items.Add("Disabled",null,null).Enabled = false; var_Items.Add("Item 2",null,null); var_Items.Add("Item 3",null,null); extoolbar1.Refresh();
JScript/JavaScript
<BODY onload='Init()'> <SCRIPT FOR="ToolBar1" EVENT="SelectItem(Itm)" LANGUAGE="JScript"> alert( "SelectItem should not be fired while locked" ); </SCRIPT> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="ToolBar1"></OBJECT> <SCRIPT LANGUAGE="JScript"> function Init() { ToolBar1.Locked = true; var var_Items = ToolBar1.Items; var_Items.Add("Disabled",null,null).Enabled = false; var_Items.Add("Item 2",null,null); var_Items.Add("Item 3",null,null); ToolBar1.Refresh(); } </SCRIPT> </BODY>
VBScript
<BODY onload='Init()'> <SCRIPT LANGUAGE="VBScript"> Function ToolBar1_SelectItem(Itm) With ToolBar1 alert( "SelectItem should not be fired while locked" ) End With End Function </SCRIPT> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="ToolBar1"></OBJECT> <SCRIPT LANGUAGE="VBScript"> Function Init() With ToolBar1 .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 axToolBar1_SelectItem(object sender, AxEXTOOLBARLib._IToolBarEvents_SelectItemEvent e) { System.Diagnostics.Debug.Print( "SelectItem should not be fired while locked" ); } //this.axToolBar1.SelectItem += new AxEXTOOLBARLib._IToolBarEvents_SelectItemEventHandler(this.axToolBar1_SelectItem); axToolBar1.Locked = true; EXTOOLBARLib.Items var_Items = axToolBar1.Items; var_Items.Add("Disabled",null,null).Enabled = false; var_Items.Add("Item 2",null,null); var_Items.Add("Item 3",null,null); axToolBar1.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(); extoolbar1.Locked(true); var_Items = extoolbar1.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"); extoolbar1.Refresh(); }
Delphi 8 (.NET only)
// SelectItem event - Occurs when the user selects the item. procedure TWinForm1.AxToolBar1_SelectItem(sender: System.Object; e: AxEXTOOLBARLib._IToolBarEvents_SelectItemEvent); begin with AxToolBar1 do begin OutputDebugString( 'SelectItem should not be fired while locked' ); end end; with AxToolBar1 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.ToolBar1SelectItem(ASender: TObject; Itm : IItem); begin with ToolBar1 do begin OutputDebugString( 'SelectItem should not be fired while locked' ); end end; with ToolBar1 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.ToolBar1 DEBUGOUT( "SelectItem should not be fired while locked" ) endwith with thisform.ToolBar1 .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 oToolBar oToolBar = form.Activex1.nativeObject ? "SelectItem should not be fired while locked" return local oToolBar,var_Item,var_Items oToolBar = form.Activex1.nativeObject oToolBar.Locked = true var_Items = oToolBar.Items // var_Items.Add("Disabled").Enabled = false var_Item = var_Items.Add("Disabled") with (oToolBar) TemplateDef = [Dim var_Item] TemplateDef = var_Item Template = [var_Item.Enabled = false] endwith var_Items.Add("Item 2") var_Items.Add("Item 3") oToolBar.Refresh()
XBasic (Alpha Five)
' Occurs when the user selects the item. function SelectItem as v (Itm as OLE::Exontrol.ToolBar.1::IItem) Dim oToolBar as P oToolBar = topparent:CONTROL_ACTIVEX1.activex ? "SelectItem should not be fired while locked" end function Dim oToolBar as P Dim var_Item as P Dim var_Items as P oToolBar = topparent:CONTROL_ACTIVEX1.activex oToolBar.Locked = .t. var_Items = oToolBar.Items ' var_Items.Add("Disabled").Enabled = .f. var_Item = var_Items.Add("Disabled") oToolBar.TemplateDef = "Dim var_Item" oToolBar.TemplateDef = var_Item oToolBar.Template = "var_Item.Enabled = False" var_Items.Add("Item 2") var_Items.Add("Item 3") oToolBar.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 oToolBar oToolBar = ole_1.Object MessageBox("Information",string( "SelectItem should not be fired while locked" )) */ /*end event SelectItem*/ OleObject oToolBar,var_Items oToolBar = ole_1.Object oToolBar.Locked = true var_Items = oToolBar.Items var_Items.Add("Disabled").Enabled = false var_Items.Add("Item 2") var_Items.Add("Item 3") oToolBar.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(oToolBar,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 oToolBar oForm := XbpDialog():new( AppDesktop() ) oForm:drawingArea:clipChildren := .T. oForm:create( ,,{100,100}, {640,480},, .F. ) oForm:close := {|| PostAppEvent( xbeP_Quit )} oToolBar := XbpActiveXControl():new( oForm:drawingArea ) oToolBar:CLSID := "Exontrol.ToolBar.1" /*{DDF58CFA-750F-45E0-8A00-CFBE431702E2}*/ oToolBar:create(,, {10,60},{610,370} ) oToolBar:SelectItem := {|Itm| OnSelectItem(oToolBar,Itm)} /*Occurs when the user selects the item.*/ oToolBar:Locked := .T. oItems := oToolBar:Items() oItems:Add("Disabled"):Enabled := .F. oItems:Add("Item 2") oItems:Add("Item 3") oToolBar:Refresh() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN