Skip to content

OnDefineButtons - cWebColumnButton

Determines the buttons to create for each row when the column has dynamic buttons

Type: Event

Syntax

Procedure OnDefineButtons

Description

When pbDynamic is True, a variable set of dynamic buttons can be displayed for each row. In this case, the OnDefineButtons event will be triggered in this object for every row of data that is sent to the grid.

This event does not fire for manually loaded grids, and you will have to send AddButton for each cell in OnManualLoadData.

Implement the OnDefineButtons event to create the set of buttons to be displayed on each row. Inside OnDefineButtons you will send the AddButton message for each button you wish to add for a given row of this column.

Sample

In this example, the OnDefineButtons event creates one button ("Edit") for every row where Customer.Status <> "Y" and two buttons ("Edit" and "Deactivate") for every row where Customer.Status = "Y".

Object oDynamicBtnCol is a cWebColumnButton
    Set piWidth to 80
    Set pbDynamic to True

    // Called for each row to define the buttons that need to be displayed.
    Procedure OnDefineButtons
        // Use AddButton to define a button (sID, sCaption, sCSSClass)
        Send AddButton "E" "Edit" ""

        // The Global buffer contains the right record for data aware lists
        If (Customer.Status = "Y") Begin
            Send AddButton "D" "Deactivate" ""
        End
    End_Procedure
End_Object