extoolbar - sample code |
How can I add items to the toolbar? VBA (MS Access, Excell...) With ToolBar1 .ArrangeItemsAs = 513 ' ArrangeItemsEnum.exArrangeItemsScroll Or ArrangeItemsEnum.exArrangeItemsHorizontal With .Items .BackColor = RGB(240,240,240) With .Add("Expand",2) .GroupPopup = 259 ' GroupPopupEnum.exGroupPopupVertical Or GroupPopupEnum.exNoGroupPopupFrame Or GroupPopupEnum.exGroupPopup .Check = True .ShowPopupOnChecked = True With .Items .Padding = "22,0,0,0" .Add("Radio 1").Radio = True .Add("Radio 2").Radio = True With .Add("Radio 3") .Radio = True .Checked = True End With End With .Checked = True End With End With .Refresh End With VB6 With ToolBar1 .ArrangeItemsAs = ArrangeItemsEnum.exArrangeItemsScroll Or ArrangeItemsEnum.exArrangeItemsHorizontal With .Items .BackColor = RGB(240,240,240) With .Add("Expand",2) .GroupPopup = GroupPopupEnum.exGroupPopupVertical Or GroupPopupEnum.exNoGroupPopupFrame Or GroupPopupEnum.exGroupPopup .Check = True .ShowPopupOnChecked = True With .Items .Padding = "22,0,0,0" .Add("Radio 1").Radio = True .Add("Radio 2").Radio = True With .Add("Radio 3") .Radio = True .Checked = True End With End With .Checked = True End With End With .Refresh End With VB.NET With Extoolbar1 .ArrangeItemsAs = exontrol.EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsScroll Or exontrol.EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsHorizontal With .Items .BackColor = Color.FromArgb(240,240,240) With .Add("Expand",2) .GroupPopup = exontrol.EXTOOLBARLib.GroupPopupEnum.exGroupPopupVertical Or exontrol.EXTOOLBARLib.GroupPopupEnum.exNoGroupPopupFrame Or exontrol.EXTOOLBARLib.GroupPopupEnum.exGroupPopup .Check = True .ShowPopupOnChecked = True With .Items .Padding = "22,0,0,0" .Add("Radio 1").Radio = True .Add("Radio 2").Radio = True With .Add("Radio 3") .Radio = True .Checked = True End With End With .Checked = True End With End With .Refresh() End With VB.NET for /COM With AxToolBar1 .ArrangeItemsAs = EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsScroll Or EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsHorizontal With .Items .BackColor = RGB(240,240,240) With .Add("Expand",2) .GroupPopup = EXTOOLBARLib.GroupPopupEnum.exGroupPopupVertical Or EXTOOLBARLib.GroupPopupEnum.exNoGroupPopupFrame Or EXTOOLBARLib.GroupPopupEnum.exGroupPopup .Check = True .ShowPopupOnChecked = True With .Items .Padding = "22,0,0,0" .Add("Radio 1").Radio = True .Add("Radio 2").Radio = True With .Add("Radio 3") .Radio = True .Checked = True End With End With .Checked = True End With 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(); spToolBar1->PutArrangeItemsAs(EXTOOLBARLib::ArrangeItemsEnum(EXTOOLBARLib::exArrangeItemsScroll | EXTOOLBARLib::exArrangeItemsHorizontal)); EXTOOLBARLib::IItemsPtr var_Items = spToolBar1->GetItems(); var_Items->PutBackColor(RGB(240,240,240)); EXTOOLBARLib::IItemPtr var_Item = var_Items->Add(L"Expand",long(2),vtMissing); var_Item->PutGroupPopup(EXTOOLBARLib::GroupPopupEnum(EXTOOLBARLib::exGroupPopupVertical | EXTOOLBARLib::exNoGroupPopupFrame | EXTOOLBARLib::exGroupPopup)); var_Item->PutCheck(VARIANT_TRUE); var_Item->PutShowPopupOnChecked(VARIANT_TRUE); EXTOOLBARLib::IItemsPtr var_Items1 = var_Item->GetItems(); var_Items1->PutPadding(L"22,0,0,0"); var_Items1->Add(L"Radio 1",vtMissing,vtMissing)->PutRadio(VARIANT_TRUE); var_Items1->Add(L"Radio 2",vtMissing,vtMissing)->PutRadio(VARIANT_TRUE); EXTOOLBARLib::IItemPtr var_Item1 = var_Items1->Add(L"Radio 3",vtMissing,vtMissing); var_Item1->PutRadio(VARIANT_TRUE); var_Item1->PutChecked(VARIANT_TRUE); var_Item->PutChecked(VARIANT_TRUE); spToolBar1->Refresh(); C++ Builder ToolBar1->ArrangeItemsAs = Extoolbarlib_tlb::ArrangeItemsEnum::exArrangeItemsScroll | Extoolbarlib_tlb::ArrangeItemsEnum::exArrangeItemsHorizontal; Extoolbarlib_tlb::IItemsPtr var_Items = ToolBar1->Items; var_Items->BackColor = RGB(240,240,240); Extoolbarlib_tlb::IItemPtr var_Item = var_Items->Add(L"Expand",TVariant(2),TNoParam()); var_Item->GroupPopup = Extoolbarlib_tlb::GroupPopupEnum::exGroupPopupVertical | Extoolbarlib_tlb::GroupPopupEnum::exNoGroupPopupFrame | Extoolbarlib_tlb::GroupPopupEnum::exGroupPopup; var_Item->Check = true; var_Item->ShowPopupOnChecked = true; Extoolbarlib_tlb::IItemsPtr var_Items1 = var_Item->Items; var_Items1->Padding = L"22,0,0,0"; var_Items1->Add(L"Radio 1",TNoParam(),TNoParam())->Radio = true; var_Items1->Add(L"Radio 2",TNoParam(),TNoParam())->Radio = true; Extoolbarlib_tlb::IItemPtr var_Item1 = var_Items1->Add(L"Radio 3",TNoParam(),TNoParam()); var_Item1->Radio = true; var_Item1->Checked = true; var_Item->Checked = true; ToolBar1->Refresh(); C# extoolbar1.ArrangeItemsAs = exontrol.EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsScroll | exontrol.EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsHorizontal; exontrol.EXTOOLBARLib.Items var_Items = extoolbar1.Items; var_Items.BackColor = Color.FromArgb(240,240,240); exontrol.EXTOOLBARLib.Item var_Item = var_Items.Add("Expand",2,null); var_Item.GroupPopup = exontrol.EXTOOLBARLib.GroupPopupEnum.exGroupPopupVertical | exontrol.EXTOOLBARLib.GroupPopupEnum.exNoGroupPopupFrame | exontrol.EXTOOLBARLib.GroupPopupEnum.exGroupPopup; var_Item.Check = true; var_Item.ShowPopupOnChecked = true; exontrol.EXTOOLBARLib.Items var_Items1 = var_Item.Items; var_Items1.Padding = "22,0,0,0"; var_Items1.Add("Radio 1",null,null).Radio = true; var_Items1.Add("Radio 2",null,null).Radio = true; exontrol.EXTOOLBARLib.Item var_Item1 = var_Items1.Add("Radio 3",null,null); var_Item1.Radio = true; var_Item1.Checked = true; var_Item.Checked = true; extoolbar1.Refresh(); JScript/JavaScript <BODY onload="Init()"> <OBJECT CLASSID="clsid:8A047308-84CB-4B50-90D7-AFD27BB4639C" id="ToolBar1"></OBJECT> <SCRIPT LANGUAGE="JScript"> function Init() { ToolBar1.ArrangeItemsAs = 513; var var_Items = ToolBar1.Items; var_Items.BackColor = 15790320; var var_Item = var_Items.Add("Expand",2,null); var_Item.GroupPopup = 259; var_Item.Check = true; var_Item.ShowPopupOnChecked = true; var var_Items1 = var_Item.Items; var_Items1.Padding = "22,0,0,0"; var_Items1.Add("Radio 1",null,null).Radio = true; var_Items1.Add("Radio 2",null,null).Radio = true; var var_Item1 = var_Items1.Add("Radio 3",null,null); var_Item1.Radio = true; var_Item1.Checked = true; var_Item.Checked = true; ToolBar1.Refresh(); } </SCRIPT> </BODY> VBScript <BODY onload="Init()"> <OBJECT CLASSID="clsid:8A047308-84CB-4B50-90D7-AFD27BB4639C" id="ToolBar1"></OBJECT> <SCRIPT LANGUAGE="VBScript"> Function Init() With ToolBar1 .ArrangeItemsAs = 513 ' ArrangeItemsEnum.exArrangeItemsScroll Or ArrangeItemsEnum.exArrangeItemsHorizontal With .Items .BackColor = RGB(240,240,240) With .Add("Expand",2) .GroupPopup = 259 ' GroupPopupEnum.exGroupPopupVertical Or GroupPopupEnum.exNoGroupPopupFrame Or GroupPopupEnum.exGroupPopup .Check = True .ShowPopupOnChecked = True With .Items .Padding = "22,0,0,0" .Add("Radio 1").Radio = True .Add("Radio 2").Radio = True With .Add("Radio 3") .Radio = True .Checked = True End With End With .Checked = True End With End With .Refresh End With End Function </SCRIPT> </BODY> C# for /COM axToolBar1.ArrangeItemsAs = EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsScroll | EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsHorizontal; EXTOOLBARLib.Items var_Items = axToolBar1.Items; var_Items.BackColor = (uint)ColorTranslator.ToWin32(Color.FromArgb(240,240,240)); EXTOOLBARLib.Item var_Item = var_Items.Add("Expand",2,null); var_Item.GroupPopup = EXTOOLBARLib.GroupPopupEnum.exGroupPopupVertical | EXTOOLBARLib.GroupPopupEnum.exNoGroupPopupFrame | EXTOOLBARLib.GroupPopupEnum.exGroupPopup; var_Item.Check = true; var_Item.ShowPopupOnChecked = true; EXTOOLBARLib.Items var_Items1 = var_Item.Items; var_Items1.Padding = "22,0,0,0"; var_Items1.Add("Radio 1",null,null).Radio = true; var_Items1.Add("Radio 2",null,null).Radio = true; EXTOOLBARLib.Item var_Item1 = var_Items1.Add("Radio 3",null,null); var_Item1.Radio = true; var_Item1.Checked = true; var_Item.Checked = true; axToolBar1.Refresh(); X++ (Dynamics Ax 2009) public void init() { COM com_Item,com_Item1,com_Items,com_Items1; anytype var_Item,var_Item1,var_Items,var_Items1; ; super(); extoolbar1.ArrangeItemsAs(513/*exArrangeItemsScroll | exArrangeItemsHorizontal*/); var_Items = extoolbar1.Items(); com_Items = var_Items; com_Items.BackColor(WinApi::RGB2int(240,240,240)); var_Item = com_Items.Add("Expand",COMVariant::createFromInt(2)); com_Item = var_Item; com_Item.GroupPopup(259/*exGroupPopupVertical | exNoGroupPopupFrame | exGroupPopup*/); com_Item.Check(true); com_Item.ShowPopupOnChecked(true); var_Items1 = com_Item.Items(); com_Items1 = var_Items1; com_Items1.Padding("22,0,0,0"); var_Item1 = COM::createFromObject(com_Items1.Add("Radio 1")); com_Item1 = var_Item1; com_Item1.Radio(true); var_Item1 = COM::createFromObject(com_Items1.Add("Radio 2")); com_Item1 = var_Item1; com_Item1.Radio(true); var_Item1 = com_Items1.Add("Radio 3"); com_Item1 = var_Item1; com_Item1.Radio(true); com_Item1.Checked(true); com_Item.Checked(true); extoolbar1.Refresh(); } Delphi 8 (.NET only) with AxToolBar1 do begin ArrangeItemsAs := Integer(EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsScroll) Or Integer(EXTOOLBARLib.ArrangeItemsEnum.exArrangeItemsHorizontal); with Items do begin BackColor := $f0f0f0; with Add('Expand',TObject(2),Nil) do begin GroupPopup := Integer(EXTOOLBARLib.GroupPopupEnum.exGroupPopupVertical) Or Integer(EXTOOLBARLib.GroupPopupEnum.exNoGroupPopupFrame) Or Integer(EXTOOLBARLib.GroupPopupEnum.exGroupPopup); Check := True; ShowPopupOnChecked := True; with Items do begin Padding := '22,0,0,0'; Add('Radio 1',Nil,Nil).Radio := True; Add('Radio 2',Nil,Nil).Radio := True; with Add('Radio 3',Nil,Nil) do begin Radio := True; Checked := True; end; end; Checked := True; end; end; Refresh(); end Delphi (standard) with ToolBar1 do begin ArrangeItemsAs := Integer(EXTOOLBARLib_TLB.exArrangeItemsScroll) Or Integer(EXTOOLBARLib_TLB.exArrangeItemsHorizontal); with Items do begin BackColor := $f0f0f0; with Add('Expand',OleVariant(2),Null) do begin GroupPopup := Integer(EXTOOLBARLib_TLB.exGroupPopupVertical) Or Integer(EXTOOLBARLib_TLB.exNoGroupPopupFrame) Or Integer(EXTOOLBARLib_TLB.exGroupPopup); Check := True; ShowPopupOnChecked := True; with Items do begin Padding := '22,0,0,0'; Add('Radio 1',Null,Null).Radio := True; Add('Radio 2',Null,Null).Radio := True; with Add('Radio 3',Null,Null) do begin Radio := True; Checked := True; end; end; Checked := True; end; end; Refresh(); end VFP with thisform.ToolBar1 .ArrangeItemsAs = 513 && ArrangeItemsEnum.exArrangeItemsScroll Or ArrangeItemsEnum.exArrangeItemsHorizontal with .Items .BackColor = RGB(240,240,240) with .Add("Expand",2) .GroupPopup = 259 && GroupPopupEnum.exGroupPopupVertical Or GroupPopupEnum.exNoGroupPopupFrame Or GroupPopupEnum.exGroupPopup .Check = .T. .ShowPopupOnChecked = .T. with .Items .Padding = "22,0,0,0" .Add("Radio 1").Radio = .T. .Add("Radio 2").Radio = .T. with .Add("Radio 3") .Radio = .T. .Checked = .T. endwith endwith .Checked = .T. endwith endwith .Refresh endwith dBASE Plus local oToolBar,var_Item,var_Item1,var_Item2,var_Item3,var_Items,var_Items1 oToolBar = form.EXTOOLBARACTIVEXCONTROL1.nativeObject oToolBar.ArrangeItemsAs = 513 /*exArrangeItemsScroll | exArrangeItemsHorizontal*/ var_Items = oToolBar.Items var_Items.BackColor = 0xf0f0f0 var_Item = var_Items.Add("Expand",2) var_Item.GroupPopup = 259 /*exGroupPopupVertical | exNoGroupPopupFrame | exGroupPopup*/ var_Item.Check = true var_Item.ShowPopupOnChecked = true var_Items1 = var_Item.Items var_Items1.Padding = "22,0,0,0" // var_Items1.Add("Radio 1").Radio = true var_Item1 = var_Items1.Add("Radio 1") with (oToolBar) TemplateDef = [dim var_Item1] TemplateDef = var_Item1 Template = [var_Item1.Radio = True] endwith // var_Items1.Add("Radio 2").Radio = true var_Item2 = var_Items1.Add("Radio 2") with (oToolBar) TemplateDef = [dim var_Item2] TemplateDef = var_Item2 Template = [var_Item2.Radio = True] endwith var_Item3 = var_Items1.Add("Radio 3") var_Item3.Radio = true var_Item3.Checked = true var_Item.Checked = true oToolBar.Refresh() XBasic (Alpha Five) Dim oToolBar as P Dim var_Item as P Dim var_Item1 as local Dim var_Item2 as local Dim var_Item3 as P Dim var_Items as P Dim var_Items1 as P oToolBar = topparent:CONTROL_ACTIVEX1.activex oToolBar.ArrangeItemsAs = 513 'exArrangeItemsScroll + exArrangeItemsHorizontal var_Items = oToolBar.Items var_Items.BackColor = 15790320 var_Item = var_Items.Add("Expand",2) var_Item.GroupPopup = 259 'exGroupPopupVertical + exNoGroupPopupFrame + exGroupPopup var_Item.Check = .t. var_Item.ShowPopupOnChecked = .t. var_Items1 = var_Item.Items var_Items1.Padding = "22,0,0,0" ' var_Items1.Add("Radio 1").Radio = .t. var_Item1 = var_Items1.Add("Radio 1") oToolBar.TemplateDef = "dim var_Item1" oToolBar.TemplateDef = var_Item1 oToolBar.Template = "var_Item1.Radio = True" ' var_Items1.Add("Radio 2").Radio = .t. var_Item2 = var_Items1.Add("Radio 2") oToolBar.TemplateDef = "dim var_Item2" oToolBar.TemplateDef = var_Item2 oToolBar.Template = "var_Item2.Radio = True" var_Item3 = var_Items1.Add("Radio 3") var_Item3.Radio = .t. var_Item3.Checked = .t. var_Item.Checked = .t. oToolBar.Refresh() Visual Objects local var_Item,var_Item1 as IItem local var_Items,var_Items1 as IItems oDCOCX_Exontrol1:ArrangeItemsAs := exArrangeItemsScroll | exArrangeItemsHorizontal var_Items := oDCOCX_Exontrol1:Items var_Items:BackColor := RGB(240,240,240) var_Item := var_Items:Add("Expand",2,nil) var_Item:GroupPopup := exGroupPopupVertical | exNoGroupPopupFrame | exGroupPopup var_Item:Check := true var_Item:ShowPopupOnChecked := true var_Items1 := var_Item:Items var_Items1:Padding := "22,0,0,0" var_Items1:Add("Radio 1",nil,nil):Radio := true var_Items1:Add("Radio 2",nil,nil):Radio := true var_Item1 := var_Items1:Add("Radio 3",nil,nil) var_Item1:Radio := true var_Item1:Checked := true var_Item:Checked := true oDCOCX_Exontrol1:Refresh() PowerBuilder OleObject oToolBar,var_Item,var_Item1,var_Items,var_Items1 oToolBar = ole_1.Object oToolBar.ArrangeItemsAs = 513 /*exArrangeItemsScroll | exArrangeItemsHorizontal*/ var_Items = oToolBar.Items var_Items.BackColor = RGB(240,240,240) var_Item = var_Items.Add("Expand",2) var_Item.GroupPopup = 259 /*exGroupPopupVertical | exNoGroupPopupFrame | exGroupPopup*/ var_Item.Check = true var_Item.ShowPopupOnChecked = true var_Items1 = var_Item.Items var_Items1.Padding = "22,0,0,0" var_Items1.Add("Radio 1").Radio = true var_Items1.Add("Radio 2").Radio = true var_Item1 = var_Items1.Add("Radio 3") var_Item1.Radio = true var_Item1.Checked = true var_Item.Checked = true oToolBar.Refresh() Visual DataFlex Procedure OnCreate Forward Send OnCreate Set ComArrangeItemsAs to (OLEexArrangeItemsScroll + OLEexArrangeItemsHorizontal) Variant voItems Get ComItems to voItems Handle hoItems Get Create (RefClass(cComItems)) to hoItems Set pvComObject of hoItems to voItems Set ComBackColor of hoItems to (RGB(240,240,240)) Variant voItem Get ComAdd of hoItems "Expand" 2 Nothing to voItem Handle hoItem Get Create (RefClass(cComItem)) to hoItem Set pvComObject of hoItem to voItem Set ComGroupPopup of hoItem to (OLEexGroupPopupVertical + OLEexNoGroupPopupFrame + OLEexGroupPopup) Set ComCheck of hoItem to True Set ComShowPopupOnChecked of hoItem to True Variant voItems1 Get ComItems of hoItem to voItems1 Handle hoItems1 Get Create (RefClass(cComItems)) to hoItems1 Set pvComObject of hoItems1 to voItems1 Set ComPadding of hoItems1 to "22,0,0,0" Variant voItem1 Get ComAdd of hoItems1 "Radio 1" Nothing Nothing to voItem1 Handle hoItem1 Get Create (RefClass(cComItem)) to hoItem1 Set pvComObject of hoItem1 to voItem1 Set ComRadio of hoItem1 to True Send Destroy to hoItem1 Variant voItem2 Get ComAdd of hoItems1 "Radio 2" Nothing Nothing to voItem2 Handle hoItem2 Get Create (RefClass(cComItem)) to hoItem2 Set pvComObject of hoItem2 to voItem2 Set ComRadio of hoItem2 to True Send Destroy to hoItem2 Variant voItem3 Get ComAdd of hoItems1 "Radio 3" Nothing Nothing to voItem3 Handle hoItem3 Get Create (RefClass(cComItem)) to hoItem3 Set pvComObject of hoItem3 to voItem3 Set ComRadio of hoItem3 to True Set ComChecked of hoItem3 to True Send Destroy to hoItem3 Send Destroy to hoItems1 Set ComChecked of hoItem to True 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 oItem,oItem1 LOCAL oItems,oItems1 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" /*{8A047308-84CB-4B50-90D7-AFD27BB4639C}*/ oToolBar:create(,, {10,60},{610,370} ) oToolBar:ArrangeItemsAs := 513/*exArrangeItemsScroll+exArrangeItemsHorizontal*/ oItems := oToolBar:Items() oItems:SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. )) oItem := oItems:Add("Expand",2) oItem:GroupPopup := 259/*exGroupPopupVertical+exNoGroupPopupFrame+exGroupPopup*/ oItem:Check := .T. oItem:ShowPopupOnChecked := .T. oItems1 := oItem:Items() oItems1:Padding := "22,0,0,0" oItems1:Add("Radio 1"):Radio := .T. oItems1:Add("Radio 2"):Radio := .T. oItem1 := oItems1:Add("Radio 3") oItem1:Radio := .T. oItem1:Checked := .T. oItem:Checked := .T. oToolBar:Refresh() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |