Class: cWebColumnButton
Properties | Events | Methods | Index of Classes
Web Framework class that adds buttons to a list or grid cell
Hierarchy
cObject > cWebBaseObject > cWebObject > cWebBaseUIObject > cWebBaseDEOServer > cWebBaseControl > cWebBaseDEO > cWebColumnButton
Show full hierarchy and direct subclasses
Library: Web Application Class Library
Package: cWebColumnButton.pkg
Mixins: cWebColumn_mixin
Description
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.
Sample
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" ""
End
End_Procedure
Procedure OnClick String sButton String sRowId
Forward Send OnClick sButton sRowId
If (sButton = "E") Begin
Send ShowCustomer sRowId
End
Else If (sButton = "D") Begin
Send DeactivateCustomer sRowID
End
End_Procedure
End_Object
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.
Sample
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
End_Procedure
End_Object
Sample
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]
...
End_Procedure
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.