Print Page | Close Window

Adding a Combo Box to Command Bar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=6539
Printed Date: 06 November 2025 at 4:50am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Adding a Combo Box to Command Bar
Posted By: shagge22
Subject: Adding a Combo Box to Command Bar
Date Posted: 01 March 2007 at 11:00am
I am adding a combo box to a command bar. I need to display a text string that is much longer than the size of the combo box. Is there a way to expand the width of the combo box? I am using version 10.3.

Code:
Dim Control As CommandBarControl
Dim PresetBar As CommandBar

Set PresetBar = Cmd_Bar.Add("Preset", xtpBarTop)
    
With PresetBar.Controls
    Set Control = .Add(xtpControlLabel, ID_PRESET_LABEL,
    "Saved Scanner Presets:")
       
    Set Control = .Add(xtpControlComboBox,
    ID_PRESET_COMBO, "No Scanner Presets Available")
    Control.Enabled = True
       
    Set Control = .Add(xtpControlButton,
    ID_PRESET_BUTTON, "")
    Control.Caption = "Set Default"
End With



Replies:
Posted By: jcollier
Date Posted: 01 March 2007 at 11:31am
I did the following with a Ribbon.  I'm not sure if it's the 'preferred' method, but it worked.

In General Declarations:

Dim FilterCombo as CommandBarComboBox

In function that creates the ribbonbar:

Dim ControlCombo As CommandBarComboBox

Set ControlCombo = GroupContainer.Add(xtpControlComboBox, ID_FILTERCONTAINERLIST, "Filter")
        ControlCombo.Width = 200
        ControlCombo.DropDownListStyle = False
        ControlCombo.EditHint = "Container Filter..."
        ControlCombo.AddItem "Find Unbilled Containers Due Today"
        ControlCombo.AddItem "Find Unbilled Containers Past Due"
        ControlCombo.AddItem "Find Unbilled Containers Not Past Due"

        Set FilterCombo = ControlCombo

'then use FilterCombo to call events.  You'll have to alter it a bit for 'command bars but I hope this helps.


Posted By: shagge22
Date Posted: 01 March 2007 at 12:20pm
That worked.

Thanks for your help...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net