Print Page | Close Window

PushButton DropDown

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=17108
Printed Date: 27 November 2024 at 6:59am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: PushButton DropDown
Posted By: Hemesh
Subject: PushButton DropDown
Date 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



Replies:
Posted By: Hemesh
Date 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


Posted By: moe188
Date 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


Posted By: jpbro
Date 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



Posted By: Hemesh
Date 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



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