NxtRow

From Br Wiki
Jump to: navigation, search

The NxtRow, Next, and NxtCol internal functions we're introduced in BR! 4.20.

Next, NxtRow and NxtCol

The keyword Next can be used in the same manner as CUR in that the next cursor position within a 2D control can be identified.

00100 INPUT FIELDS "row,col,GRID 10/60, SUB, NEXT, NOWAIT": next_pos

The NxtRow is a internal function that identifies the character position or cell row associated with the next cursor position (e.g. where the mouse was last clicked). If the next cursor position is in a LIST or GRID, then NxtRow specifies the cell clicked within it. If not a 2D control, it specifies the first character position of the next control to receive focus.

NxtCol specifies the column of the respective position.

With respect to these functions, the next cursor position can be the result of keyboard or mouse activity. If the next position results from keyboard activity then NxtRow has the same value as CurRow when Enter is pressed or control was returned in response to a leading attribute such as X (return control upon exit). When the mouse is used to return control to a program, the next cursor position is the pointer location that is double clicked or hot location that is single clicked.

One key concept here is that just as one must keep track of what type of control was last accessed, by means other than CurRow and CurCol, similarly **one must determine the type of control to be next accessed by means other than NxtRow and NxtCol**. This can be done with the system function NxtFld plus hotkey event (fkey) numbers.

CurCol/NxtCol have a slight change in functionality in 4.20 release. Previously they specified the column (relative to the window) of the cursor position. Now they specify the first position of the respective control.

Option 59 has been added to make CurCol (not NxtCol) work the old way.

User_Entry

A leading attribute "^user_entry" returns control to the program upon the cursor entering a field. This does not apply to fields given initial focus by INPUT processing, such as with CURFLD or the first field of a FIELDS operation.

If control is returned to a program because Enter is pressed or in response to the ^user_entry attribute then CURROW has the same value as NXTROW. But when control is returned as a result of the X or AE field attributes CURROW returns the row of the most recent cell or field in focus, and NXTROW returns the row that would be in focus had control not returned to the program. When the mouse is used to return control to a program, the ‘next cursor position’ is the location (row,col) of the cell or control that is double clicked or hot location that is single clicked.