Returns the current object focus.

Available in:

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


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


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.


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