Attaching controls to Commandbar |
Post Reply |
Author | |
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
Posted: 06 February 2008 at 12:01pm |
When attaching a Combobox, Colorpicker (in general controls which have a dropdown section) to a commandbar, mousedown event outside the dropdown commandbar area (but inside the combobox dropdown area) causes the dropdown area to disappear or sometimes will lose the handle (I think) with the attached control. Combobox is floating where you put in the IDE. Click on the on the commandbarbutton again will attach the control to the commandbar.
If combobox is in picturebox sometimes the dropdown area of commandbar disappears.
Am I missing something here?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Yes its true. :-( Can you use Our builtin CommandBarComboBox and Colopicker ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Oleg, You wouldn't believe me if I said that the combobox isn't working properly , and for the Colorpicker I didn't really put much effort in it. It's not that important since I use the propertygrid for all my app settings. Great control by the way Now, this is what I did
I added the combobox to the commandbar, then:
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.DropDownListStyle = True toolComboTest.DropDownWidth = 100 toolComboTest.ListIndex = 1 toolComboTest.Width = 200 toolComboTest.ThemedItems = false'' see picture 1
toolComboTest.ThemedItems = True '' see picture 2 This is another combobox (works properly)
Set toolComboControlitems = CommandBarSubviews.FindControl(, ID_TOOLBAR_COMBOCONTROLITEMS) toolComboControlitems.AddItem "Select item..." toolComboControlitems.ListIndex = 1 toolComboControlitems.Width = 250 toolComboControlitems.ThemedItems = True ''LOOK, set to true and the items will be set to for example: another font Picture 1
Picture 2
Notice the width of the dropdown area. I feel an other adventure coming up hahaha. (This is not a laugh of joy...)
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
I need some sample to test. Please attach one.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, Its kind of feature :) If you use ThemedItems you need call it before you add items because ThemedItems =True destroy list, destroy items and create list again.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Oleg,
Yes, I noticed the difference between the two combo's. With one the ThemedItems is set to true before filling the combo and the other one after the filling of the combo.
Is it possible to check this kind of behaviour somewhere? It would be nice that I know this in advance and not asking you everytime I will be using a lot of settings which will be set to the users needs, so it would be nice if I could check this.
Thank you for the answer, now I the how and why
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |