Kbase P132631: When using a touch screen how can I tell if a specific widget has focus?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  6/24/2008 |
|
Status: Unverified
GOAL:
When using a touch screen how can I tell if a specific widget has focus?
GOAL:
When using a touch screen how can I force focus into a specific widget?
FACT(s) (Environment):
OpenEdge 10.x
Progress 9.x
Windows
FIX:
When using a touch screen system where your Progress application uses NO-FOCUS buttons to emulate a keyboard you can determine whether the Progress application truly has focus by using the Windows GetFocus API call.
This is required as it is possible to have another application be the foreground application then pressing the NO-FOCUS button of your application and have Windows send the keystroke to the wrong application.
The following code shows how to do this:
PROCEDURE GetFocus EXTERNAL "USER32":
DEFINE RETURN PARAMETER pHWND AS LONG NO-UNDO.
END PROCEDURE.
PROCEDURE SetFocus EXTERNAL "USER32":
DEFINE INPUT PARAMETER pHWND AS LONG NO-UNDO.
DEFINE RETURN PARAMETER pResult AS LONG NO-UNDO.
END PROCEDURE.
DEFINE VARIABLE iFocusedWidget AS INTEGER NO-UNDO.
RUN GetFocus (OUTPUT iFocusedWidget).
/* If Focus Is Not Where I Want It, Put It There */
IF iFocusedWidget <> SomeWidgetInYourApplication:HWND THEN
RUN SetFocus (INPUT SomeWidgetInYourApplication:HWND, OUTPUT iFocusedWidget).