Purpose
A callback method for editing a column value.
Class
Type
Method
Syntax
<oBrowser>:CellEdit(<iMode>) Æ lSuccess
Arguments
<iMode> | The edit mode of the cell. The following modes can occur: |
Edit mode |
Description |
Return value |
BEDIT_CREATE |
The control for the edit is created. |
The return value FALSE prevents the edit. |
BEDIT_INIT |
The control for the edit is initialized. |
The return value FALSE prevents the edit. |
BEDIT_SHOW |
The control for the edit is shown. |
The return value is not checked. |
BEDIT_END |
The value in the edit control is checked and taken over, if it is valid. |
The return value FALSE not finished the edit, but continues it. |
BEDIT_CANCEL |
The edit in the control is canceled. |
The return value FALSE cancel the edit not, but continues it. |
BEDIT_COMMIT |
The edit was saved. A commit is not executed automatically by bBrowser. This mode can also be used on its own just to execute a solitary commit. |
The return value is not checked. |
BEDIT_HIDE |
The control for the edit is hidden. |
The return value is not checked. |
Data Type: | Integer |
Return Value
lSuccess | A logical value that indicates whether the edit mode was correctly processed. |
Data Type: | Logic |
Description
bBrowser:CellEdit() is a callback method that is called by the bBrowser whenever the value of a cell is to be edited. The method checks whether a method with the same name is defined in the owner of the bBrowser and calls this with an object of class bCellEditEvent as argument.
The entire editing procedure for a column value is divided into 5 steps. For each step the browser calls the method CellEdit() with the appropriate edit mode. The owner of the browser can react by the definition of its own CellEdit() method to these edit modes.
Samples
The following sample shows the definition of its own CellEdit() method in the owner of the browser. The browser calls this automatically.
METHOD CellEdit(oCellEditEvent) CLASS DataWindow
// check the edit mode
LOCAL oFS AS FieldSpec
LOCAL cText AS STRING
IF oCellEditEvent:EditMode=BEDIT_CREATE
IF oCellEditEvent:EditCell:Column=1 .and. oCellEditEvent:EditCell:Row=2
// row 2 in the first column may not be changed
// -> The input is not permitted by the return of FALSE.
RETURN FALSE
ENDIF
ELSEIF oCellEditEvent:EditMode=BEDIT_INIT
// for the third column a minimum input length is set
IF oCellEditEvent:EditCell:Column=3
oFS := oCellEditEvent:EditControl:FieldSpec
oFS:SetMinLength(4,HyperLabel{"Column 3", ,"The minimum input length is 4"})
ENDIF
ELSEIF oCellEditEvent:EditMode=BEDIT_END
// empty inputs forbid
// -> The input is not terminated but is continued
// by the return of FALSE
cText := oCellEditEvent:EditControl:TextValue
oCellEditEvent:EditControl:TextValue := RTrim(UPPER(cText))
IF EMPTY(oCellEditEvent:EditControl:TextValue)
RETURN FALSE
ENDIF
ELSEIF oCellEditEvent:EditMode=BEDIT_COMMIT
// commit implement
// -> This is expected by some servers (BufferedServer !?)
oCellEditEvent:Control:Server:Commit()
ENDIF
RETURN TRUE
See Also
Page url: http://www.YOURSERVER.com/index.html?bbrowser_celledit.htm