Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - PushButton DropDown
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PushButton DropDown

 Post Reply Post Reply
Author
Message
Hemesh View Drop Down
Senior Member
Senior Member


Joined: 10 August 2010
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hemesh Quote  Post ReplyReply Direct Link To This Post Topic: PushButton DropDown
    Posted: 13 August 2010 at 8:42am
Hi Guys,

Is it possible to show a dropdown menu from a commandbar (or from some other control) to show a menu below the button rather than the VB Menus? The reason for this is that I want to make sure the control supports unicode and the VB menu system doesn't!

I tried to use the ShowPopup() feature for the command bars but unfortunatly nothing happened, so i might be shooting a lost cause with that...
Product: Xtreme SuitePro (ActiveX) version 18.5.0

Platform: Windows 7 Enterprise (64-bit)

Language: Visual Basic 6.0
Back to Top
Hemesh View Drop Down
Senior Member
Senior Member


Joined: 10 August 2010
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hemesh Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2010 at 9:15am
Can no one help with this one? :(
Product: Xtreme SuitePro (ActiveX) version 18.5.0

Platform: Windows 7 Enterprise (64-bit)

Language: Visual Basic 6.0
Back to Top
moe188 View Drop Down
Senior Member
Senior Member


Joined: 27 March 2006
Status: Offline
Points: 220
Post Options Post Options   Thanks (0) Thanks(0)   Quote moe188 Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2010 at 11:21am
hi,
I am not sure if that what you are looking for:
 
    Dim MenuBar As CommandBar
    Dim ControlColorPopup As CommandBarPopup
   
    Set MenuBar = CommandBars1.Add("MenuBar", xtpBarTop)
    With MenuBar.Controls
        Set ControlColorPopup = .Add(xtpControlSplitButtonPopup, ID_MENU, "Menu")
        ControlColorPopup.CommandBar.Controls.Add xtpControlButton, ID_MENU1, "SubMenu 1"
        ControlColorPopup.CommandBar.Controls.Add xtpControlButton, ID_MENU2, "SubMenu 2"
        ControlColorPopup.CommandBar.Controls.Add xtpControlButton, ID_MENU3, "Submenu 3"
    End With
good luck
 
Visual Baisc 6 SP6

Windows XP Pro Sp3, Windows 7
Codejock Xtreme SuitePro ActiveX 15.1.3
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 19 August 2010 at 11:25am
Try this on a form with a CommandBars control and a PushButton with the Style set to xtpButtonDropDown:


Option Explicit

Private Type POINTAPI
   x As Long
   y As Long
End Type

Private Declare Function ClientToScreen Lib "user32.dll" (ByVal hwnd As Long, ByRef lpPoint As POINTAPI) As Long


Private Sub Form_Load()
   ' Create a sample command bar, attached to the ContextMenus collection
   With Me.CommandBars1
      .DeleteAll
     
      With .ContextMenus.Add(100, "Test")
         .Controls.Add xtpControlButton, 101, "Test"
         .Controls.Add xtpControlButton, 102, "Test2"
         .Controls.Add xtpControlButton, 103, "Test3"
      End With
   End With
End Sub

Private Sub PushButton1_DropDown()
   Dim lt_Pt As POINTAPI
  
   ' Get position for popup menu based on button position & height
   lt_Pt.x = Me.PushButton1.Left
   lt_Pt.y = Me.PushButton1.Top + Me.PushButton1.Height
  
   ' Convert popup menu position to pixels
   If Me.ScaleMode <> vbUser Then
      lt_Pt.x = Me.ScaleX(lt_Pt.x, Me.ScaleMode, vbPixels)
      lt_Pt.y = Me.ScaleY(lt_Pt.y, Me.ScaleMode, vbPixels)
   End If
  
   ' Convert popup menu position to screen coordinates
   ClientToScreen Me.hwnd, lt_Pt
  
   ' Convert popup menu position back to client scalemode
   If Me.ScaleMode <> vbUser Then
      lt_Pt.x = Me.ScaleX(lt_Pt.x, vbPixels, Me.ScaleMode)
      lt_Pt.y = Me.ScaleY(lt_Pt.y, vbPixels, Me.ScaleMode)
   End If
  
   ' Show the popup menu. ContextMenus collection is 1-based
   Me.CommandBars1.ContextMenus(1).ShowPopup TPM_RETURNCMD, lt_Pt.x, lt_Pt.y
End Sub

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Hemesh View Drop Down
Senior Member
Senior Member


Joined: 10 August 2010
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hemesh Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2010 at 3:42am
moe188, not that no :)

jbpro, many thanks, that's exactly what I was looking for! That should hopefully show me a dropdown now that is unicode compliant and show me those russian character sets properly :)
Product: Xtreme SuitePro (ActiveX) version 18.5.0

Platform: Windows 7 Enterprise (64-bit)

Language: Visual Basic 6.0
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.172 seconds.