Class: cWebColumnButton

Properties  Events  Methods    Index of Classes

Web Framework class that adds buttons to a list or grid cell



Library: Web Application Class Library

Package: cWebColumnButton.pkg

Mixins: cWebColumn_mixin


Web list and grid controls provide the basis for creating multi-row, multi-column display and entry. Each column in a grid is represented by a column object. Web lists and grids (cWebList, cWebGrid) use the cWebColumn, cWebColumnButton, cWebColumnCheckbox, cWebColumnCombo, cWebColumnDate, cWebColumnImage and cWebColumnLink classes for column objects.

Use this column to add buttons to the cWebList or cWebGrid.

By default, a single button is shown, but using the OnDefineButtons and AddButton calls, multiple buttons can be shown. The OnClick event gets the button name (for multiple buttons), RowId and column value as parameters when it is clicked.


The code sample below shows how multiple buttons can be added to a column by implementing the OnDefineButtons event on the column object. The AddButton procedure can be used add buttons for the current row. Note that the global buffer will contain the right record for this row in case of a data aware list.

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" ""

    Procedure OnClick String sButton String sRowId
        Forward Send OnClick sButton sRowId

        If (sButton = "E") Begin
            Send ShowCustomer sRowId
        Else If (sButton = "D") Begin
            Send DeactivateCustomer sRowID

If a button is clicked, OnClick will be triggered with the ID of the button as a parameter indicating which button is clicked. This allows the developer to perform the right action.


The code sample below shows a static web column button.

Object oSingleBtnCol is a cWebColumnButton
    Set piWidth to 35
    Set psCaption to ""
    Set psButtonCaption to "Edit"
    Procedure OnClick String sButton String sRowId
        Send ShowCustomer sRowId


The code sample below shows how to dynamically add a web column button.

Procedure OnManualLoadData tWebRow[] ByRef aTheRows String ByRef sCurrentRowID
    Integer iRow
    Integer iDynButton_col
    String sDynButtonId sDynButtonCssClass sDynButtonCaption
    // the Dynamic button is only painted when an ID has been given
    Move sDynButtonId to aTheRows[iRow].aCells[iDynButton_col].aOptions[0]
    Move sDynButtonCssClass to aTheRows[iRow].aCells[iDynButton_col].aOptions[1]
    Move sDynButtonCaption to aTheRows[iRow].aCells[iDynButton_col].aOptions[2]


Drag and Drop Support

This control can be used as a valid drop target by registering it as such in a cWebDragDropHelper object.

The supported actions for this control are:
- C_WebDropOnControl

This allows the control to accept data dragged from elsewhere in the control (if configured that way) and can also be used to accept files when registered within a cWebDragDropFileHelper.