PRB: Form Not Released from Menu Pad or ON KEY LABELLast reviewed: January 10, 1997Article ID: Q156238 |
The information in this article applies to:
SYMPTOMSA form released from a procedure or command called from a menu or an ON KEY LABEL command is not actually released until the command or procedure has completed.
WORKAROUNDSet the Visible property of the form to .F. - False to hide the form until the procedure that releases it has finished executing.
STATUSThis behavior is by design.
MORE INFORMATIONThe Keypress event of the form intercepts the keystroke, and the form cannot be released until the procedure or command called by the keystroke has completed.
Steps to Reproduce Behavior1. Run the following code from a .prg:
ON KEY LABEL F3 DO Release_It oForm = CREATEOBJECT('form') oForm.Caption = "Press F3 to release form, then F3 to Clear Events" oForm.SHOW() READ EVENTS ON KEY LABEL F3 PROCEDURE Release_It oForm.RELEASE =MESSAGEBOX("Though form has been released, _SCREEN.Formcount = " ; + ALLTR(STR(_SCREEN.FORMCOUNT,1)) + ". Press F3 after OK to " ; + "return to Command Window." ,0) ON KEY LABEL F3 CLEAR EVENTS ENDPROC Modify the Release_It procedure in the above example as follows to demonstrate the workaround. (The form is still not immediately released from memory but setting the Visible property to .F. - False makes it appear released.)
PROCEDURE Release_It oForm.Visible = .F. oForm.RELEASE =MESSAGEBOX("Though form has been released, _SCREEN.Formcount = " ; + ALLTR(STR(_SCREEN.FORMCOUNT,1)) + ". Press F3 after OK to " ; + "return to Command Window." ,0) ON KEY LABEL F3 CLEAR EVENTS ENDPROC |
KBCategory: kbtool kbui kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |