Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title PtContainerGiveFocus() returning value
Ref. No. QNX.000009823
Category(ies) Development
Issue What are the conditions under which PtContainerGiveFocus() returns:
1. NULL
2. a pointer to a widget other that that which was passed as an arg to the function.

Solution 1. If return value is NULL, it means that the widget you are trying to give focus is:
x09- NULL
x09- Disjoint(a window)
x09- Blocked (has the Pt_BLOCKED flag set in its Pt_ARG_FLAGS resource)
x09- has been destroyed prior to the five focus attempt.
The event passed into PtContainerGiveFocus(if not NULL) has already caused a focus change, as indicated by event->processing_flags and Ph_DIRECTED_FOCUS.

2. If return value is a pointer to a widget, other that that which was passed as an arg to the function happens, for example:

- if a widget refuses to relinquish focus (returns Pt_END from its Pt_CB_LOST_FOCUS callback), which usually happens when the requirements of an entry field have not been met and must be met before any other action can take place.
There are other reasons to refuse to relinquish focus, but that is the most common.

The lib never does this on its own. If this is happening, it is one of your apps Pt_CB_LOST_FOCUS callbacks.