Kbase 15812: Why doesn't code in Main Block run in SmartWindows ?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
Why doesn't code in Main Block run in SmartWindows ?
Often programmers put code in the main block of a SmartWindow. If the
code is placed BEFORE windowmn.i is included then you must be careful
that the code you are placing there does not require that widgets have
already been realized since windowmn.i has not yet run.
If you place it AFTER windowmn.i, it will run when running
the window from the UIB. This is because the UIB runs the window
persistently. This means that a wait-for in windowmn.i is NOT executed
and the flow of control will drop through windowmn.i to the
code that is in the main block.
If you place the code AFTER windowmn.i and then run the window from
the Procedure Editor in the following way, then the code will NOT
be executed until AFTER the window is closed:
run window-1.w
This is because you are running the window NON-persistently. This
means that the wait-for in windowmn.i is going to be activated and
you will not drop out of windowmn.i to the main block code until
after the wait-for has been satisfied (e.g. you close the window).
The solution is to place the code in a local-initialize routine
instead of in the main block so that it will always run.
For guidelines on how to run SmartWindows from other SmartWindows,
please refer to knowledgebase entry 15813
' How to Run SmartWindows from other SmartWindows'
Progress Software Technical Support Note # 15812