focus

Returns the current object focus.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X        

Syntax

int focus(type[,id])
int       type,id

Description

Returns the id of the field in the current window that has focus or 0. If no field has focus, it returns 0. If no window has focus, it returns -1.
type specifies focus. False (0) specifies field focus; true (nonzero) specifies window focus.

id (optional) specifies a widget id when type = 0

if id is specified and type is false then the focus is set on widget id.

Example

A sample focus change event trigger could perform:
{ int i;
  i = p.ar;
  p.ar = focus(false) % field_rows();
  list_seek(p.wl,list_pos(p.wl)+p.ar-i);
  p.af = focus(false) / field_rows();
}