Hide

SftButton/OCX 3.0 - Button Control

Display
Print

Popup Sample (VB6)

This sample illustrates drop down buttons and popup menus.

The source code is located at C:\Program Files (x86)\Softelvdm\SftButton OCX 3.0\Samples\VB6\Popup\Form1.frm or C:\Program Files\Softelvdm\SftButton OCX 3.0\Samples\VB6\Popup\Form1.frm (on 32-bit Windows versions).

Option Explicit

Dim LastPicture As Integer

Private Sub CloseButton_Click()
    Unload Form2
    End
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Unload Form2
End Sub

Private Sub PicTimer_Timer()
    ' Update the button bitmap every so often to get the
    ' spinning globe effect
    With SftButton4
        Set .Image1.Picture = WImage(LastPicture).Picture
        LastPicture = LastPicture + 1
        If LastPicture >= 16 Then LastPicture = 0
    End With
End Sub

Private Sub SftButton1_Click()
    ' Invoke the default action, because the button was clicked
    Call Form2.popupMenu_DefaultAction_Click
End Sub

Private Sub SftButton1_DropDownClick()
    ' The drop down button was clicked. Display a popup menu
    ' right-aligned with the right edge of the button
    Dim x As Single, y As Single
    With SftButton1
        x = .Left + .Width
        y = .Top + .Height
        PopupMenu Form2.mainMenu, vbPopupMenuRightAlign, x, y, Form2.popupMenu_DefaultAction
    End With
End Sub

Private Sub SftButton2_Click()
    ' Invoke the default action, because the button was clicked
    Call Form2.popupMenu_DefaultAction_Click
End Sub

Private Sub SftButton2_DropDownClick()
    ' The drop down button was clicked. Display a popup menu
    ' right-aligned with the right edge of the button
    Dim x As Single, y As Single
    With SftButton2
        x = .Left + .Width
        y = .Top + .Height
        .BorderAlways = True
        PopupMenu Form2.mainMenu, vbPopupMenuRightAlign, x, y, Form2.popupMenu_DefaultAction
        .BorderAlways = False
    End With
End Sub

Private Sub SftButton3_Click()
    ' Invoke the default action, because the button was clicked
    Call Form2.popupMenu_DefaultAction_Click
End Sub

Private Sub SftButton3_DropDownClick()
    ' The drop down button was clicked. Display a popup menu
    ' right-aligned with the right edge of the button
    Dim x As Single, y As Single
    With SftButton3
        x = .Left + .Width
        y = .Top + .Height
        PopupMenu Form2.mainMenu, vbPopupMenuRightAlign, x, y, Form2.popupMenu_DefaultAction
    End With
End Sub

Private Sub SftButton4_Click()
    ' Invoke the default action, because the button was clicked
    Call Form2.popupMenu_DefaultAction_Click
End Sub

Private Sub SftButton4_DropDownClick()
    ' The drop down button was clicked. Display a popup menu
    ' right-aligned with the right edge of the button
    Dim x As Single, y As Single
    With SftButton4
        x = .Left + .Width
        y = .Top + .Height
        PopupMenu Form2.mainMenu, vbPopupMenuRightAlign, x, y, Form2.popupMenu_DefaultAction
    End With
End Sub

Private Sub SftButton5_Click()
    ' Invoke the default action, because the button was clicked
    Call Form2.popupMenu_DefaultAction_Click
End Sub

Private Sub SftButton5_DropDownClick()
    ' The drop down button was clicked. Display a popup menu
    ' right-aligned with the right edge of the button
    Dim x As Single, y As Single
    With SftButton5
        x = .Left + .Width
        y = .Top + .Height
        PopupMenu Form2.mainMenu, vbPopupMenuRightAlign, x, y, Form2.popupMenu_DefaultAction
    End With
End Sub





Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.