Spread.StartEdit Event
Occurs when the cursor moves to a new cell.
The following child objects are attached to the Event object.
| Type | Name | Description |
|---|---|---|
| Number | row | Moved row position |
| Number | col | Moved column position |
Normally, in the event handler of the StartEdit event, write the code that prepares the cell for editing by the SetEditor method. You can edit cells by using a separately defined TextBox object. The StopEdit event, which is paired with the StartEdit event, reflects the input contents in the spreadsheet.
Example
Number edit_row;
Number edit_col;
Function OnStartEdit(e) {
var edit;
switch (e.col) {
case 0:
edit = frmSpreadEdit.ebText; /* 1列目の編集 */
break;
case 1:
edit = frmSpreadEdit.ebNumber; /* 2列目の編集 */
break;
case 2:
edit = frmSpreadEdit.ebDate; /* 3列目の編集 */
break;
default:
return;
}
edit_row = e.row; /* 編集を開始した行と列を記録 */
edit_col = e.col;
edit.Value= GetCell(r, c); /* 入力値をコピー */
SetEditor(edit); /* Spreadに貼り付け */
edit.Visible = $TRUE; /* 表示 */
edit.SetFocus(); /* 入力フォーカスセット */
}
Since Biz / Browser events go through the event queue, be sure to use the row and col objects that are passed as child objects of the StartEdit event or StopEdit event. In the OnStartEdit, OnStopEdit event handler, if you use the Value and ColumnPosition properties to get the cursor position, it may be different from the position notified by the event.
The StartEdit event is paired with the StopEdit event, but there is no guarantee of its order of occurrence. Note that the following events can occur:
StartEdit (row = 0, col = 0)
StartEdit (row = 1, col = 0)
StopEdit (row = 0, col = 0)
StopEdit (row = 1, col = 0)