The information in this article applies to:
SUMMARY
An event is an action generated by a user, a program, or the system. When
an event is triggered, Visual FoxPro processes some default system tasks.
For example, pressing a key triggers the keypress event that causes the
letter to be displayed in a text box. With Visual FoxPro, you can control
the occurrence of system events. This article describes how to prevent
system processing of events, and how to cause default events to occur
before user-generated or code-generated events occur.
MORE INFORMATIONPreventing System Processing from OccurringUse the NODEFAULT keyword in method code to prevent system processing of events. For example, in an input field, you can prevent some characters from being displayed by using the NODEFAULT clause in a Keypress event handler. The default behavior when a key is pressed is to display the character being typed. The NODEFAULT keyword is used in the MAIN form of the CONTROLS project located in the SAMPLES\CONTROLS directory.For more information about NODEFAULT, search for DEFINE CLASS in the Visual FoxPro Help menu. Forcing System Processing to Occur Before User-Defined Code Is ProcessedYou can cause the system code for the event to be processed first - before the user-defined code is prcessed. This is useful, for example, if you want to control the starting position of a text selection when the control gets the focus. Default processing of the GotFocus event causes the SelStart property to be set to zero (0), and the insertion point (cursor) is positioned before the first character displayed in the control.You can't just set the value of the SelStart property in the GotFocus event because the GotFocus default processing occurs after user code is processed, so the SelStart property is reset to zero (0). The default processing of the GotFocus event must occur before the value of the SelStart property is customized. To make the default processing occur first, you need to modify the GotFocus event code in the GotFocus event handler to follow this sequence:
Sample Code to Place in the GotFocus Method of a Text Box Control
Additional query words: VFoxWin form selection
Keywords : kbcode FxprgClassoop |
Last Reviewed: August 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |