.TH inputfocus  3w "19 July 91" "Version 3.0" "OLIT Widget Set"
.SH NAME
OlCallAcceptFocus, OlCanAcceptFocus,
OlGetCurrentFocusWidget, OlHasFocus, OlMoveFocus,
OlSetInputFocus \- manipulates input focus for widgets and gadgets.
.SH SYNOPSIS
.	\"  phony BP macro for PostScript using -mex's CP
.	\"  
.	\"  made changes to:
.	\"  1) prevent $2 vertical space needed from forcing a page break
.	\"	this is necessary because large apparent offsets are used
.	\" 	when invoking the macro eg, .BP ATT_PS_file 6i -1i 
.	\"  	This is necessary to get the ATT PS figures onto the page,
.	\"  	Following the .BP macro, there is a .sp -3.5i to move back
.	\"  	up the page.  A page break happens if the test is performed.
.	\"  	So I fiddled it.
.	\"  
.	\" 	 removed test that forces page break
.	\"		.if (\\n(tYu-\\$8+1v)>(\\n(.tu-\\nz) \{ 
.	\"  
.	\"  	 added $8 to do a .sp -$8 back/upward space
.	\"  
.	\"  	 move ^B bottom-of-page-trap off page temporarily
.	\"  	  to print diagram, then restore it
.	\"  1a) Sept 90 renamed to .CP	 
.	\"  	 
.	\"  	 
.	\"  2) added other -mex functions
.	\"  	.FN - figure numbers
.	\"  	.TN - table numbers
.	\"  	.IX - index macro
.	\"  
.	\"  
.	\"  3) added .TH from mansun to get header name right
.	\"  
.	\"  4) added J series macros
.	\"  	JL	bold if nroff, listing if troff
.	\"  	JR	roman font
.	\"  	JS	= JL
.	\"  	JE	= JR
.	\"  
.	\"  
.	\"  
.	\"  obsoleted by putting them in a tbl with no box
.	\"  5a)	added nr Ji - indent for args in function prototypes
.	\"  5b)	JF macro to align args to function prototypes
.	\"	  \\$1 = type
.	\"	  \\$2 = name
.	\"	  \\$3 = allow enough space for a string this long
.	\"	    if \\n(Jf string variable is defined, it will
.	\"	    be used if $3 is not present
.	\"
.	\"  6) Jq macro to put a box around items at the beginning
.	\"     of an X resource in the widgets
.	\"     syntax: .Jq \fIclass\fP:XtCAlignment	\
.	\"     \fItype\fP:OlDefine	\fIdefault\fP:OL_CENTER	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taccess: \\$4
.if t \{\
.nr jw \w'\\fL\\$1\\fP'
.nr jw \\n(jw+\w'\\fL\\$2\\fP'
.nr jw \\n(jw+\w'\\fL\\$3\\fP'
.br
.mk jq
.ie \\n(jw>1300 \{\
 \\fIclass\\fP:\|\\&\\fL\\$1\0\fItype\\fP:\|\\&\\fL\\$2\0\
\\fIdefault\\fP:\|\\&\\fL\\$3\\fP\
\h'|4.9i'\\fIaccess\\fP:\|\|\\&\\fL\\$4\\fP\h'0.8i-\w'\\fL\\$4\\fP'u'\
\}
.el \{\
 \\fIclass\\fP:\|\\&\\fL\\$1\\fP\h'1.5i-\w'\\fL\\$1\\fP'u'\
\\fItype\\fP:\|\\&\\fL\\$2\\fP\h'1.25i-\w'\\fL\\$2\\fP'u'\
\\fIdefault\\fP:\|\\&\\fL\\$3\\fP\h'1.0i-\w'\\fL\\$3\\fP'u'\
\h'|5i'\\fIaccess\\fP:\|\\&\\fL\\$4\\fP\h'0.8i-\w'\\fL\\$4\\fP'u'\
\}
.sp -.5
.nf
\h'-.5n'\L'|\\n(jqu-1'\l'\\n(.lu-1.25i+1n\(ul'\L'-|\\n(jqu+1'\l'|0u-.5n\(ul'
.sp -1
\}
.fi
..
.nr Ji 16
.	\"
.de JF
.ie !"\\$3"" .nr  Jf \w'\\$3'
.el .nr Jf \w'\\*(Jf'
\\$1 \h'.25i+\\n(Jfu-\w'\\$1'u'\\$2
.br
..
.	\"
.	\"
.	\" I - italic font
.de I
.nr PQ \\n(.f
.if t .ft 2
.ie \\$1 .if n .ul 999
.el .if n .ul 1
.if t .if !\\$1 \{\
.	ie '\\*(.T'psc' \&\f\\n(PQ\\$3\fI\\$1\f\\n(PQ\\$2
.	el \&\f\\n(PQ\\$3\fI\\$1\|\f\\n(PQ\\$2
.\}
.if n .if \\n(.$=1 \&\\$1
.if n .if \\n(.$>2 \&\\$3\c
.if n .if \\n(.$>1 \&\\$1\c
.if n .if \\n(.$>1 \&\\$2
..
.	\" B - bold font
.de B
.nr PQ \\n(.f
.if t .ft 3
.ie \\$1 .if n .ul 999
.el .if n .ul 1
.if t .if !\\$1 \&\f\\n(PQ\\$3\fB\\$1\f\\n(PQ\\$2
.if n .if \\n(.$=1 \&\\$1
.if n .if \\n(.$>2 \&\\$3\c
.if n .if \\n(.$>1 \&\\$1\c
.if n .if \\n(.$>1 \&\\$2
..
.	\" R - Roman font
.de R
.if n .ul 0
.ft 1
..
.	\" L - listing font
.de L
.nr PQ \\n(.f
.ie \\$1 .if n .ul 999
.el .if n .ul 1
.if t .if !\\$1 \&\f\\n(PQ\\$3\fL\\$1\f\\n(PQ\\$2
.if n .if \\n(.$=1 \&\\$1
.if n .if \\n(.$>2 \&\\$3\c
.if n .if \\n(.$>1 \&\\$1\c
.if n .if \\n(.$>1 \&\\$2
..
.	\" LB - bold listing font
.de LB
.nr PQ \\n(.f
.ie \\$1 .if n .ul 999
.el .if n .ul 1
.if t .if !\\$1 \&\f\\n(PQ\\$3\f(LB\\$1\f\\n(PQ\\$2
.if n .if \\n(.$=1 \&\\$1
.if n .if \\n(.$>2 \&\\$3\c
.if n .if \\n(.$>1 \&\\$1\c
.if n .if \\n(.$>1 \&\\$2
..
.	\" LX - listing font with index
.	\"
.	\" - jl - invented these
.	\"
.de Lx
.L "\\$1" "\\$2" "\\$3"
.IX "\\$1" "" "\fL\\$1\f1"
..
.de Ix
.I "\\$1" "\\$2" "\\$3"
.IX "\\$1" "" "\fL\\$1\f1"
..
.de Bx
.I "\\$1" "\\$2" "\\$3"
.IX "\\$1" "" "\fL\\$1\f1"
..
.	\"
.	\" - jl - invented these
.	\"
.de JL
.if t .if \\n(.$=0 .ft L
.if t .if \\n(.$>0 .L "\\$1" "\\$2" "\\$3"
.if n .if \\n(.$=0 .ft B
.if n .if \\n(.$>0 .I "\\$1" "\\$2" "\\$3"
..
.de Jx
.ie t .Lx "\\$1" "\\$2" "\\$3"
.el  .Bx "\\$1" "\\$2" "\\$3"
..
.de JX
.ie t .Lx "\\$1" "\\$2" "\\$3"
.el  .Bx "\\$1" "\\$2" "\\$3"
..
.de JR
.ft 1
..
.de JS
.JL
.nf
..
.de JE
.JR
.fi
..
.\"	
.\"	start FN/TN related
.\"	
.\"	end FN/TN
.\"
.	\" TF - print TN or FN
.de TF
.nr TF \\n(.f
.nr TX \\n(.s
.	\" - jl force it to full page, rather than strip out stuff
.nr PL 3
.if \\n(PL=1 \{\
.	ta \\n(GIu-\\n(GUuR \\n(GIu 
.	ti 0
	\&\s11\\*(tS\t\fI\&\\$1\f\\n(TF\\s\\n(TX
.\}
.if \\n(PL=2 \{\
.	ta \\n(LLuR \\n(LLu+\\n(GUu 
.	nf
	\&\s11\fI\&\\$1\f\\n(TF\t\&\\*(tS\\s\\n(TX
.	fi
.\}
.if \\n(PL=3 \{\
.	ta 2iR 2.25i
.	ti 0
	\&\s11\0\0\\*(tS\t\fI\&\\$1\f\\n(TF\\s\\n(TX
.\}
..
.	\" TN - table name
.	\" changed \\n(PN to \\n%
.de TN
.nr T1 +1
.ll \\n(LLu
.ds tH \\$1
.	\" - jl only number, not chapter 
.	\".ds tS Table \\n(H1-\\n(T1
.ds tS Table \\n(T1
.if \\nM>1 .ds tS Table \\n(T1
.if !\\n(IK \{\
.	if \\n(nlu>\\n(L#u .sp 1v
.	if \\n(B#>0 .if \\n(B#u>=\\n(nlu .sp |\\n(B#u+2v
.	nr B# 0
.\}
.if \\n(IK \{\
.	sp 1v
.	ie \\n(K# \{\
.		sp |\\n(K#u+2v
.		nr K# 0 \}
.	el \{\
.		if \\n(B#u>=\\n(nlu .sp (\\n(B#u-\\n(nlu+1v)u
.		nr B# 0 \}
.\}
.ne 2i
.TF "\\*(tH"
.if \\nF .if \\n(IK \!.tm .CE T 1 "\\$1" \\\\n% \\n(H1 \\n(T1
.if \\nF .if !\\n(IK .tm .CE T 1 "\\$1" \\n% \\n(H1 \\n(T1
..
.	\" TC - table continued (multi-page)
.de TC
.if !\\n(tC \{\
.	as tH \(em Continued
.	nr tC 1
.\}
.TF "\\*(tH"
.sp \\n(PDu
..
.	\" FN - figure name
.de FN
.nr F1 +1
.ll \\n(LLu
.	\" - jl only number, not chapter too
.	\".ds tS Figure \\n(H1-\\n(F1
.ds tS Figure \\n(F1
.if \\nM>1 .ds tS Figure \\n(F1
.sp 1v
.TF "\\$1"
.if \\nF .if \\n(IK \!.tm .CE F 1 "\\$1" \\\\n% \\n(H1 \\n(F1
.if \\nF .if !\\n(IK .tm .CE F 1 "\\$1" \\n% \\n(H1 \\n(F1
..
.\"	
.\"	start IX index
.\"	
.	\" IX - Make an Index Entry
.	\" $1 and $2: primary and secondary collating terms
.	\" $3 and $4: primary and secondary printing terms
.	\" $5 and $6: PAGE specifications or PRINT field
.	\".de IX
.	\" - jl PN to %
.	\".if \\nF .if !\\n(IK .tm .IE\tENTRY\t\\$1\t\\$2\t\\$3\t\\$4\t\\$5\t\\$6\t\\n%
.	\".if \\nF .if \\n(IK \!.tm .IE\tENTRY\t\\$1\t\\$2\t\\$3\t\\$4\t\\$5\t\\$6\t\\\\n%
..
.\"	end IX index
.\"	
.\"	
.\"	
.\"	
.ig
.	\"
.	\" - jl added from -mansun 0
.	# title heading
.de TH
.PD
.DT
.nr F1 0
.if n .nr IN .5i
.if t .nr IN .5i
.ll 7i
.nr LL \\n(.l
.ds ]H \\$1\|(\|\\$2\|)
.ds ]D Misc. Reference Manual Pages
.	\" added this one - removed the rest
.if '\\$2'3W' .ds ]D OPEN LOOK Widgets
.if !'\\$4''  .ds ]W \\$4
.if !'\\$5''  .ds ]D \\$5
.ds ]D 3W
.wh 0 }H
.wh -.8i }F
.em }M
.if !\\n(nl .if !\\nP .nr P 1
.if !\\n(nl .if \\nP .pn \\nP
.if \\nA .if \\nP>=\\nA \{\
.	ds PN \\nP
.	pn 1
.	af % a
.	nr A 0
.\}
.if !\\n(nl .if \\nP .nr P 0
.if  \\nC .if \\n(nl .bp
.if  !\\nC .if \\n(nl .bp 1
.ds ]L modified \\$3
.nr ]L \\$3
.if \\n(]L=0 .rm ]L
.}E
.DT
.nr )I .5i
.nr )R 1i
.mk ka
.if !'\\n(ka'-1' .bp
.if \\nF .tm .CE MAN-PAGE 1 \\$1(\\$2) \\n%
.ev 1
.if n .tl \\*(]W\\*(]D\\*(]H
.ev
..
.	\" careful - only 1 return at bottom
.JL
.nf
#include <Xol/OpenLook.h>
 . . .
Boolean OlCallAcceptFocus(
.in \n(Ji
.ds Jf Widget
.JF Widget     \fIw\fP,
.JF Time       \fItime\fP);
.in
.in
.JR
.fi
.JL
.nf
#include <Xol/OpenLook.h>
 . . .
Boolean OlCanAcceptFocus(
.in \n(Ji
.ds Jf Widget
.JF Widget     \fIw\fP,
.JF Time       \fItime\fP);
.in
.in
.JR
.fi
.JL
.nf
#include <Xol/OpenLook.h>
 . . .
Boolean OlSetInputFocus(
.in \n(Ji
.ds Jf Widget
.JF Widget     \fIw\fP);
.in
.JR
.fi
.JL
.nf
#include <Xol/OpenLook.h>
 . . .
Boolean OlGetCurrentFocusWidget(
.in \n(Ji
.ds Jf Widget
.JF Widget     \fIw\fP);
.in
.JR
.fi
.JL
.nf
#include <Xol/OpenLook.h>
 . . .
Boolean OlHasFocus(
.in \n(Ji
.ds Jf Widget
.JF Widget     \fIw\fP);
.in
.JR
.fi
.JL
.nf
#include <Xol/OpenLook.h>
 . . .
Boolean OlGetCurrentFocusWidget(
.in \n(Ji
.ds Jf Widget
.JF Widget     \fIw\fP);
.in
.JR
.fi
.SH DESCRIPTION
Each of these utility routines works with widgets or gadgets to manipulate input focus.
.SS OlCallAcceptFocus
If widget \f2w\fP currently is capable of accepting input focus, focus is
assigned to \f2w\fP and the function returns TRUE; otherwise, FALSE is
returned.  Time specifies the X server time of the event that initiated this
accept focus request.
.#
.#
.SS OlCanAcceptFocus
.IX "OlCanAcceptFocus" "" "\fLOlCanAcceptFocus)\fP"
If the widget can accept focus,
.JL TRUE
is returned;
otherwise,
.JL FALSE
is returned.  Acceptance of focus is determined by
the following:
.P
\(bu
The widget is not being destroyed.
.sp .5
\(bu
The widget is managed
.sp .5
\(bu
The widget is mapped when managed (if it's not a gadget)
.sp .5
\(bu
The widget is realized, or for a gadget, the gadget's parent
must be realized
.sp .5
\(bu
The widget and its ancestors are sensitive
.sp .5
\(bu
A query window attributes is successful and the widget's window is
viewable (i.e., the window and all its ancestor windows are mapped)
.P
Otherwise,
.JL FALSE
is returned.
.#
.#
.SS OlSetInputFocus
.IX "OlSetInputFocus" "" "\fLOlSetInputFocus\fP"
.LP
.JL OlSetInputFocus
sets focus to a widget.  Applications should use this
routine instead of 
.JL XSetInputFocus
since this routine checks the current
focus model and before setting focus.
.#
.#
.SS OlGetCurrentFocusWidget
.IX "OlGetCurrentFocusWidget" "" "\fLOlGetCurrentFocusWidget\fP"
.LP
.JL OlGetCurrentFocusWidget
returns the id of the widget which
currently has focus in the window group of the specified widget.  If
no widget in the window group has focus, NULL is returned.
.#
.#
.SS OlHasFocus
.IX "OlHasFocus" "" "\fLOlHasFocus\fP"
.LP
This function is simply a convenience function that calls
.JL OlGetCurrentFocusWidget
and compares the result of that call to the
supplied widget id.
.#
.#
.SS OlMoveFocus
.IX "OlMoveFocus" "" "\fLOlMoveFocus\fP"
.LP
This function moves the input focus from one widget to another and returns
the id of the new focus widget.  The routine 
.JL OlCallAcceptFocus
is used to
move the input focus.  If the function is unable to move input
focus,
.JL NULL
is returned.
.LP
When moving input focus between widgets contained within an exclusives
or non-exclusives widget, valid values for direction are:
.sp
.LP
.B Note:
For the
.JL OL_MULTI
directions below, the value of 
.I m
is
the value of the application resource
.JL XtNmultiObjectCoun t.
.sp
.IP
.JL OL_IMMEDIATE
Set focus to the next widget that will accept it, starting with
.I w .
.IP 
.Jl OL_MOVERIGHT
Set focus to the widget in the next column (and same row)
that will accept it, starting with the first column after 
.I w's
column.  If 
.I w
is located in the extreme right column,
focus is set to the widget in the extreme left column of the same row.
.IP 
.Jl OL_MOVELEFT
Set focus to the widget in the previous column (and same row)
that will accept it, starting with the first column before 
.I w's
column.  If 
.I w
is located on the extreme left column,
focus is set to the widget in the extreme right column of the same row.
(The widget columns are searched in reverse order.)
.IP 
.JL OL_MOVEUP
Set focus to the widget in the next row (and same column)
that will accept it, starting with the first row after 
.I w's
row.  If 
.I w
is located in the top row,
focus is set to the widget in the bottom row of the same column.
(The widget rows are searched in reverse order.)
.IP 
.Jl OL_MOVEDOWN
Set focus to the widget in the previous row (and same column)
that will accept it, starting with the first row before 
.I w's
row.  If 
.I w
is located in the bottom row,
focus is set to the widget in the top row of the same column.
.IP 
.Jl OL_MULTIRIGHT
Set focus to the widget in the next column (and same row)
that will accept it, starting with the first column 
.I m
columns
after 
.I w's
column.
If 
.I m
is greater than the number of objects between 
.I w
and
the extreme right column,
focus is set to the widget in the extreme left column of the same row.
.IP 
.JL OL_MULTILEFT
Set focus to the widget in the next column (and same row)
that will accept it, starting with the first column 
.I m
columns
before 
.I w's
column.
If 
.I m
is greater than the number of objects between 
.I w
and
the extreme left column,
focus is set to the widget in the extreme right column of the same row.
(The widget columns are searched in reverse order.)
.IP OL_MULTIUP
Set focus to the widget in the next row (and same column)
that will accept it, starting with the first row 
.I m
rows
after 
.I w's
row.
If 
.I m
is greater than the number of objects between 
.I w
and
the extreme bottom row,
focus is set to the widget in the extreme top row of the same column.
(The widget rows are searched in reverse order.)
.IP 
.JL OL_MULTIDOWN
Set focus to the widget in the next row (and same column)
that will accept it, starting with the first row 
.I m
rows
before 
.I w's
row.
If 
.I m
is greater than the number of objects between 
.I w
and
the extreme bottom row,
focus is set to the widget in the extreme bottom row of the same column.
.LE
When moving between widgets in a base window or popup window,
valid values for direction are:
.VL 25 5
.IP
.JL OL_IMMEDIATE
Set focus to the next object that will accept it, starting with
.I w .
.IP 
.JL OL_NEXTFIELD
Set focus to the next object that will accept it, starting with
the first object after 
.I w .
.IP 
.JL OL_PREVFIELD
Set focus to the next object that will accept it, starting with
the first object before 
.I w .
(The list is searched in reverse
order.)
.IP 
.JL OL_MOVERIGHT
Behaves like 
.JL OL_NEXTFIELD
direction.
.IP 
.JL OL_MOVELEFT
Behaves like 
.JL OL_PREVFIELD
direction.
.IP 
.JL OL_MOVEUP
Behaves like 
.JL OL_PREVFIELD
direction.
.IP 
.JL OL_MOVEDOWN
Behaves like 
.JLOL_NEXTFIELD 
direction.
.IP OL_MULTIRIGHT
Set focus to the next object that will accept it, starting with
the first object 
.I m
objects after 
.I w .
.IP OL_MULTILEFT
Set focus to the next object that will accept it, starting with
the first object 
.I m
objects before 
.I w .
(The list is searched in reverse order.)
.IP 
.JL OL_MULTIUP
Behaves like 
.JL OL_MULTILEFT direction.
.IP 
.JL OL_MULTIDOWN
Behaves like
.JL OL_MULTIRIGHT
direction.
