Oleg,
Just paste the code and you will see the behaviour I mentioned.
Const ID_TOOLBAR_TEST = 400 Const ID_TOOLBAR_COMBOCONTROLITEMS = 401
Private Sub Form_Load() LoadToolbarItems End Sub
Private Function LoadToolbarItems() CommandBarSubViews.DeleteAll Dim toolBarSubViews As CommandBar Set toolBarSubViews = CommandBarSubViews.Add("Tools subview", xtpBarTop) toolBarSubViews.BarID = 1 AddButton CommandBarSubViews(1).Controls, xtpControlComboBox, ID_TOOLBAR_COMBOCONTROLITEMS, "", True, "Select item for positioning" AddButton CommandBarSubViews(1).Controls, xtpControlComboBox, ID_TOOLBAR_TEST, "Items", True, "Width / height size selected item", xtpButtonIconAndCaption Dim toolComboTest As CommandBarComboBox Set toolComboTest = CommandBarSubViews.FindControl(, ID_TOOLBAR_TEST) Dim i As Integer For i = 1 To 20 toolComboTest.AddItem "Select item " & i Next i toolComboTest.Width = 150 toolComboTest.ThemedItems = True toolComboTest.DropDownWidth = 400
Dim toolComboControlitems As CommandBarComboBox Set toolComboControlitems = CommandBarSubViews.FindControl(, ID_TOOLBAR_COMBOCONTROLITEMS) toolComboControlitems.Width = 150 toolComboControlitems.ThemedItems = True For i = 1 To 20 toolComboControlitems.AddItem "Select item " & i Next i CommandBarSubViews.DockToolBar CommandBarSubViews(1), 0, 0, xtpBarTop CommandBarSubViews(1).EnableDocking XTPToolBarFlags.xtpFlagHideWrap CommandBarSubViews(1).ShowGripper = False CommandBarSubViews.Options.ShowExpandButtonAlways = False End Function
Private Function AddButton(Controls As CommandBarControls, ControlType As XTPControlType, Id As Long, Caption As String, Optional BeginGroup As Boolean = False, Optional DescriptionText As String = "", Optional ButtonStyle As XTPButtonStyle = xtpButtonAutomatic, Optional Category As String = "Controls") As CommandBarControl Dim Control As CommandBarControl Set Control = Controls.Add(ControlType, Id, Caption) Control.BeginGroup = BeginGroup Control.DescriptionText = DescriptionText Control.Style = ButtonStyle Control.Category = Category Control.Enabled = True Set AddButton = Control End Function
Change toolComboTest.DropDownWidth = 600 and the other combo takes over this setting.
|