PRB: Valid Clause Not Executed When Leaving ObjectID: Q124921 2.50x 2.6x 3.00 WINDOWS kbprg kbtshoot The information in this article applies to:
SYMPTOMSWhen the insertion point is positioned on a popup or a list box, and then the user clicks some other object, such as a push button, code contained in the VALID clause of the popup is not executed.
CAUSEVALID clauses are executed under two conditions: - When a user attempts to leave a field.
- When a user selects an item from a screen object.
In the latter case, the VALID clause is not executed in either a list box or popup object, because tabbing out of the object or clicking another object on the screen does not constitute leaving an object. When an element is chosen from either of these objects, only then is the VALID clause code executed. Although this may seem counter-intuitive, logically this makes sense because tabbing through a list box or popup isn't the same action as selecting an item from the list.
WORKAROUNDTo enforce the execution of Valid routines for objects like a list box or a popup, regardless of whether or not an item was chosen, use a flag to determine if the valid has been executed. The following steps explain how to do this. This example assumes that the VALID clause of the list box or popup calls a user defined procedure or function, such as listbox_valid(). 1. Create a flag in the WHEN of the list box or popup, and set it to False:
2. In the VALID procedure or function of the list box or popup set a
3. In the WHEN clause of the objects that follow and precede the list box
The above IF...ENDIF structure may need to be used in the WHEN of any
object the user may tab to or select with the mouse after entering the list
box or popup.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce ProblemCreate and run a program containing the following code:
Additional reference words: VFoxWin 3.00 FoxWin 2.50 2.50a 2.50b 2.60 2.60a
tshoot
KBCategory: kbprg kbtshoot
KBSubcategory: FxprgGeneral
|
|
Last Reviewed: May 1, 1996 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |