Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Drop command bar split button with code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Drop command bar split button with code

 Post Reply Post Reply
Author
Message
Mr.Den View Drop Down
Groupie
Groupie
Avatar

Joined: 26 August 2007
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mr.Den Quote  Post ReplyReply Direct Link To This Post Topic: Drop command bar split button with code
    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
Back to Top
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (1) Thanks(1)   Quote gibra Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Mr.Den View Drop Down
Groupie
Groupie
Avatar

Joined: 26 August 2007
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mr.Den Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.