Kbase 16421: Dynamic widget triggers in internal procedures won't fire
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/08/1999 |
|
Dynamic widget triggers in internal procedures won't fire
DYNAMIC WIDGET TRIGGERS
=======================
Triggers for dynamic widgets that have been created with an
internal procedure will not fire unless they are persistent
triggers. The reason for this is trigger scope. The scope
of a non-persistent trigger created at run-time is the
procedure, subprocedure, or trigger block in which it is
defined. For example, the trigger for the dynamic button in
the following code sample will not fire:
DEFINE VAR num-btn AS INTEGER INIT 0.
DEFINE VAR temp-hand AS WIDGET-HANDLE.
DEFINE BUTTON make-btn LABEL "Make new button".
DEFINE FRAME btn-frame with width 44.
ENABLE make-btn WITH FRAME make-frame.
ON CHOOSE OF make-btn DO:
RUN make-proc.
END.
VIEW FRAME btn-frame.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
PROCEDURE make-proc.
ASSIGN FRAME btn-frame:HEIGHT-CHARS = 10.
CREATE BUTTON temp-hand
ASSIGN
FRAME = FRAME btn-frame:HANDLE
ROW = 5
COLUMN = 10
LABEL = "New Button"
SENSITIVE = TRUE
VISIBLE = TRUE
TRIGGERS:
ON CHOOSE DO:
MESSAGE "You have selected the new button".
END.
END TRIGGERS.
END PROCEDURE.
MAKING THE TRIGGER PERSISTENT
=============================
In order to have these triggers fire (triggers for dynamic
widgets that have been created in internal procedures),
those triggers will need to be persistent. The trigger in
the code sample above will fire with the following
changes/additions:
PROCEDURE make-proc.
ASSIGN FRAME btn-frame:HEIGHT-CHARS = 10.
CREATE BUTTON temp-hand
ASSIGN
FRAME = FRAME btn-frame:HANDLE
ROW = 5
COLUMN = 10
LABEL = "New Button"
SENSITIVE = TRUE
VISIBLE = TRUE
TRIGGERS:
ON CHOOSE PERSISTENT RUN btn-mess.
END TRIGGERS.
END PROCEDURE.
PROCEDURE btn-mess.
MESSAGE "You have selected the new button".
END PROCEDURE.
REFERENCES TO WRITTEN DOCUMENTATION
===================================
Progress Programming Handbook
For more information on how to use persistent triggers with
smart objects see knowledgebase entry 16129
'Error 293 "File not found" with persistent triggers'
Progress Software Technical Support Note # 16421