Print Page | Close Window

Drop command bar split button with code

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=22528
Printed Date: 24 November 2024 at 2:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Drop command bar split button with code
Posted By: Mr.Den
Subject: Drop command bar split button with code
Date Posted: 02 February 2015 at 10:34am
Is there any way to have a command bar button (xtpControlSplitButtonPopup) drop down or open like the combo control does by setting the  '.DroppedState = True'  property?

-------------
Product: Xtreme SuitePro (ActiveX) version 16.3.1

Platform: Windows 7 Professional (64bit) - SP 1

Language: Visual Basic 6.0 SP 6



Replies:
Posted By: gibra
Date Posted: 18 April 2015 at 5:38am
Create a toolbar and add the controls as you need:
With CommandBars1
    Set cToolbar = .Add("Toolbar", xtpBarTop)
End With

Dim btnSplit As CommandBarControl
Set btnSplit = AddControl(cToolbar.Controls, xtpControlSplitButtonPopup, ID_16_HELP, "Help", True, "Open help")
With btnSplit
    .CommandBar.Controls.Add xtpControlButton, ID_16_CONTACTUS, "Contact us"
    .CommandBar.Controls.Add xtpControlButton, ID_16_ABOUT, "About"
End With

Later, you simulate the DrowDown behavior:
Private Sub PushButton1_Click()
    Dim btn As CommandBarControl
    With CommandBars1
        Set btn = .FindControl(xtpControlSplitButtonPopup, ID_16_HELP, , True)
        If Not btn Is Nothing Then
            btn.SetFocus
            SendKeys "{F4}{Down}"
        End If
    End With
End Sub



Generic AddControl function:
Public Function AddControl(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
    
    Set AddControl = Control
    
End Function


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: Mr.Den
Date Posted: 05 May 2015 at 11:26am
Thank you for that, will give it a try.

-------------
Product: Xtreme SuitePro (ActiveX) version 16.3.1

Platform: Windows 7 Professional (64bit) - SP 1

Language: Visual Basic 6.0 SP 6



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