Kbase P18191: How many dialog Dialog Boxes are active the current session?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  02/02/2003 |
|
Status: Unverified
GOAL:
How many dialog Dialog Boxes are active the current session?
FACT(s) (Environment):
Windows
FIX:
The following solution uses a recursive procedure to return the number of active DIALOG-BOX widgets in the current session.
This same code may be used to return the number of any given widget type in any given container handle.
To find the number of fill-in widgets in the current window, just assign hWidgetScope the value of CURRENT-WINDOW and the cWidgetType the value of "FILL-IN":
DEFINE VARIABLE hWidgetScope AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE cWidgetType AS CHARACTER NO-UNDO.
DEFINE VARIABLE iWidgetCount AS INTEGER NO-UNDO.
ASSIGN
hWidgetScope = SESSION
cWidgetType = "DIALOG-BOX"
iWidgetCount = 0.
RUN CountWidgets
(
INPUT hWidgetScope,
INPUT cWidgetType
).
MESSAGE iWidgetCount
VIEW-AS ALERT-BOX INFO BUTTONS OK.
PROCEDURE CountWidgets:
DEFINE INPUT PARAMETER hWidgetScope AS WIDGET-HANDLE NO-UNDO.
DEFINE INPUT PARAMETER cWidgetType AS CHARACTER NO-UNDO.
DEFINE VARIABLE hCurrentWidget AS WIDGET-HANDLE NO-UNDO.
ASSIGN
hCurrentWidget = hWidgetScope:FIRST-CHILD NO-ERROR.
DO WHILE VALID-HANDLE(hCurrentWidget):
IF hCurrentWidget:TYPE = cWidgetType THEN
iWidgetCount = iWidgetCount + 1.
RUN CountWidgets
(
INPUT hCurrentWidget,
INPUT cWidgetType
).
ASSIGN
hCurrentWidget = hCurrentWidget:NEXT-SIBLING.
END.
END PROCEDURE.