Skip to content

OnDropDown - Button

Pops up a context menu directly under the button

Type: Event

Syntax

Procedure OnDropDown

Description

This pops up a context menu directly under the button. The phoButtonPopup property determines the context menu handle. Typically, a cCJContextMenu is used for this.

Sample

This example shows how to create a button, which when clicked will invoke a menu under it.

Object oButton6 is a cSplitButton
    Set Location to 155 214
    Set Label to "Select"
    Set psImage to "down16.bmp"
    Set peImageAlign to BUTTON_IMAGELIST_ALIGN_RIGHT

    // fires when the button is clicked
    Procedure OnClick
        Send OnDropDown
    End_Procedure

    Object oButtonMenu is a cCJContextMenu
        Object oMenuItem1 is a cCJMenuItem
            Set psCaption to "Save"

            Procedure OnExecute Variant vCommandBarControl
            End_Procedure
        End_Object

        Object oMenuItem2 is a cCJMenuItem
            Set psCaption to "Clear"

            Procedure OnExecute Variant vCommandBarControl
            End_Procedure
        End_Object

        Object oMenuItem3 is a cCJMenuItem
            Set psCaption to "Delete"

            Procedure OnExecute Variant vCommandBarControl
            End_Procedure
        End_Object
    End_Object

    Set phoButtonPopup to oButtonMenu 
End_Object

The cSplitButton class can also be used with OnDropDown and phoButtonPopup. When the split button is clicked, OnDropDown is sent automatically.

Typically, a cCJContextMenu is used for the popup. If you create your own, the popup object must understand the messages Popup and SetPopupLocation and be able to close itself when appropriate.