Print Page | Close Window

Attaching controls to Commandbar

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=9512
Printed Date: 23 November 2024 at 6:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Attaching controls to Commandbar
Posted By: Aaron
Subject: Attaching controls to Commandbar
Date 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?
 



Replies:
Posted By: Oleg
Date Posted: 07 February 2008 at 1:01am
Hello,
 
Yes its true. :-( Can you use Our builtin CommandBarComboBox and Colopicker ?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Aaron
Date Posted: 07 February 2008 at 4:15pm
 
 
 

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...)


Posted By: Oleg
Date Posted: 08 February 2008 at 1:35am
Hi,
 
I need some sample to test. Please attach one.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Aaron
Date Posted: 08 February 2008 at 3:08am
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.
 
 


Posted By: Oleg
Date Posted: 08 February 2008 at 3:11pm

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


Posted By: Aaron
Date Posted: 10 February 2008 at 11:31am
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
 



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