Type | Description | |||
Itm as Item | An Item object that contains the sub-control. | |||
Ev as OleEvent | An OleEvent object that holds information about the fired event. |
The eXToolBar component may include sub-menus that displays any ActiveX / NET Component. The inside COM/ActiveX control fires its events through the ExToolBar's OleEvent event. Use the ItemTypeEnum.SubControl to add an item that hosts an ActiveX inside. Use the SubControl property to access the properties to create the inside ActiveX control.
The following screen shot displays an item with an ExCalendar inside:
Syntax for OleEvent event, /NET version, on:
private void OleEvent(object sender,exontrol.EXTOOLBARLib.Item Itm,exontrol.EXTOOLBARLib.OleEvent Ev) { } Private Sub OleEvent(ByVal sender As System.Object,ByVal Itm As exontrol.EXTOOLBARLib.Item,ByVal Ev As exontrol.EXTOOLBARLib.OleEvent) Handles OleEvent End Sub |
private void OleEvent(object sender, AxEXTOOLBARLib._IToolBarEvents_OleEventEvent e) { } void OnOleEvent(LPDISPATCH Itm,LPDISPATCH Ev) { } void __fastcall OleEvent(TObject *Sender,Extoolbarlib_tlb::IItem *Itm,Extoolbarlib_tlb::IOleEvent *Ev) { } procedure OleEvent(ASender: TObject; Itm : IItem;Ev : IOleEvent); begin end; procedure OleEvent(sender: System.Object; e: AxEXTOOLBARLib._IToolBarEvents_OleEventEvent); begin end; begin event OleEvent(oleobject Itm,oleobject Ev) end event OleEvent Private Sub OleEvent(ByVal sender As System.Object, ByVal e As AxEXTOOLBARLib._IToolBarEvents_OleEventEvent) Handles OleEvent End Sub Private Sub OleEvent(ByVal Itm As EXTOOLBARLibCtl.IItem,ByVal Ev As EXTOOLBARLibCtl.IOleEvent) End Sub Private Sub OleEvent(ByVal Itm As Object,ByVal Ev As Object) End Sub LPARAMETERS Itm,Ev PROCEDURE OnOleEvent(oToolBar,Itm,Ev) RETURN |
<SCRIPT EVENT="OleEvent(Itm,Ev)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function OleEvent(Itm,Ev) End Function </SCRIPT> Procedure OnComOleEvent Variant llItm Variant llEv Forward Send OnComOleEvent llItm llEv End_Procedure METHOD OCX_OleEvent(Itm,Ev) CLASS MainDialog RETURN NIL void onEvent_OleEvent(COM _Itm,COM _Ev) { } function OleEvent as v (Itm as OLE::Exontrol.ToolBar.1::IItem,Ev as OLE::Exontrol.ToolBar.1::IOleEvent) end function function nativeObject_OleEvent(Itm,Ev) return |
The following samples shows how to load an ActiveX control ( Exontrol.Calendar )
VBA (MS Access, Excell...)
With ToolBar1 With .Items.Add("Calendar",3).SubControl .Width = 256 .Height = 256 .ControlID = "Exontrol.Calendar" .Create End With .Refresh End With
VB6
With ToolBar1 With .Items.Add("Calendar",3).SubControl .Width = 256 .Height = 256 .ControlID = "Exontrol.Calendar" .Create End With .Refresh End With
VB.NET
With Extoolbar1 With .Items.Add("Calendar",3).SubControl .Width = 256 .Height = 256 .ControlID = "Exontrol.Calendar" .Create() End With .Refresh() End With
VB.NET for /COM
With AxToolBar1 With .Items.Add("Calendar",3).SubControl .Width = 256 .Height = 256 .ControlID = "Exontrol.Calendar" .Create() End With .Refresh() End With
C++
/* 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(); EXTOOLBARLib::IControlPtr var_Control = spToolBar1->GetItems()->Add(L"Calendar",long(3),vtMissing)->GetSubControl(); var_Control->PutWidth(256); var_Control->PutHeight(256); var_Control->PutControlID(L"Exontrol.Calendar"); var_Control->Create(); spToolBar1->Refresh();
C++ Builder
Extoolbarlib_tlb::IControlPtr var_Control = ToolBar1->Items->Add(L"Calendar",TVariant(3),TNoParam())->SubControl; var_Control->Width = 256; var_Control->Height = 256; var_Control->ControlID = L"Exontrol.Calendar"; var_Control->Create(); ToolBar1->Refresh();
C#
exontrol.EXTOOLBARLib.Control var_Control = extoolbar1.Items.Add("Calendar",3,null).SubControl; var_Control.Width = 256; var_Control.Height = 256; var_Control.ControlID = "Exontrol.Calendar"; var_Control.Create(); extoolbar1.Refresh();
JScript/JavaScript
<BODY onload='Init()'> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="ToolBar1"></OBJECT> <SCRIPT LANGUAGE="JScript"> function Init() { var var_Control = ToolBar1.Items.Add("Calendar",3,null).SubControl; var_Control.Width = 256; var_Control.Height = 256; var_Control.ControlID = "Exontrol.Calendar"; var_Control.Create(); ToolBar1.Refresh(); } </SCRIPT> </BODY>
VBScript
<BODY onload='Init()'> <OBJECT CLASSID="clsid:DDF58CFA-750F-45E0-8A00-CFBE431702E2" id="ToolBar1"></OBJECT> <SCRIPT LANGUAGE="VBScript"> Function Init() With ToolBar1 With .Items.Add("Calendar",3).SubControl .Width = 256 .Height = 256 .ControlID = "Exontrol.Calendar" .Create End With .Refresh End With End Function </SCRIPT> </BODY>
C# for /COM
EXTOOLBARLib.Control var_Control = axToolBar1.Items.Add("Calendar",3,null).SubControl; var_Control.Width = 256; var_Control.Height = 256; var_Control.ControlID = "Exontrol.Calendar"; var_Control.Create(); axToolBar1.Refresh();
X++ (Dynamics Ax 2009)
public void init() { COM com_Control,com_Item; anytype var_Control,var_Item; ; super(); var_Item = COM::createFromObject(extoolbar1.Items()).Add("Calendar",COMVariant::createFromInt(3)); com_Item = var_Item; var_Control = com_Item.SubControl(); com_Control = var_Control; com_Control.Width(256); com_Control.Height(256); com_Control.ControlID("Exontrol.Calendar"); com_Control.Create(); extoolbar1.Refresh(); }
Delphi 8 (.NET only)
with AxToolBar1 do begin with Items.Add('Calendar',TObject(3),Nil).SubControl do begin Width := 256; Height := 256; ControlID := 'Exontrol.Calendar'; Create(); end; Refresh(); end
Delphi (standard)
with ToolBar1 do begin with Items.Add('Calendar',OleVariant(3),Null).SubControl do begin Width := 256; Height := 256; ControlID := 'Exontrol.Calendar'; Create(); end; Refresh(); end
VFP
with thisform.ToolBar1 with .Items.Add("Calendar",3).SubControl .Width = 256 .Height = 256 .ControlID = "Exontrol.Calendar" .Create endwith .Refresh endwith
dBASE Plus
local oToolBar,var_Control oToolBar = form.Activex1.nativeObject var_Control = oToolBar.Items.Add("Calendar",3).SubControl var_Control.Width = 256 var_Control.Height = 256 var_Control.ControlID = "Exontrol.Calendar" var_Control.Create() oToolBar.Refresh()
XBasic (Alpha Five)
Dim oToolBar as P Dim var_Control as P oToolBar = topparent:CONTROL_ACTIVEX1.activex var_Control = oToolBar.Items.Add("Calendar",3).SubControl var_Control.Width = 256 var_Control.Height = 256 var_Control.ControlID = "Exontrol.Calendar" var_Control.Create() oToolBar.Refresh()
Visual Objects
local var_Control as IControl var_Control := oDCOCX_Exontrol1:Items:Add("Calendar",3,nil):SubControl var_Control:Width := 256 var_Control:Height := 256 var_Control:ControlID := "Exontrol.Calendar" var_Control:Create() oDCOCX_Exontrol1:Refresh()
PowerBuilder
OleObject oToolBar,var_Control oToolBar = ole_1.Object var_Control = oToolBar.Items.Add("Calendar",3).SubControl var_Control.Width = 256 var_Control.Height = 256 var_Control.ControlID = "Exontrol.Calendar" var_Control.Create() oToolBar.Refresh()
Visual DataFlex
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 Variant voItem Get ComAdd of hoItems "Calendar" 3 Nothing to voItem Handle hoItem Get Create (RefClass(cComItem)) to hoItem Set pvComObject of hoItem to voItem Variant voControl Get ComSubControl of hoItem to voControl Handle hoControl Get Create (RefClass(cComControl)) to hoControl Set pvComObject of hoControl to voControl Set ComWidth of hoControl to 256 Set ComHeight of hoControl to 256 Set ComControlID of hoControl to "Exontrol.Calendar" Send ComCreate of hoControl Send Destroy to hoControl Send Destroy to hoItem Send Destroy to hoItems Send ComRefresh End_Procedure
XBase++
#include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oControl 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} ) oControl := oToolBar:Items():Add("Calendar",3):SubControl() oControl:Width := 256 oControl:Height := 256 oControl:ControlID := "Exontrol.Calendar" oControl:Create() oToolBar:Refresh() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN