The information in this article applies to:
SYMPTOMSIf you create a form which programmatically sets a command button Default property to .T., when you navigate through controls on your form, the Default status of any of the command buttons on your forms reverts to the initial setting. For example, if your form had no default command button, there will be no default command button. If your form had a different default command button, that button will once again become the default. CAUSEThe intrinsic Visual FoxPro Gotfocus() event behavior resets the command button default properties to their initial values. RESOLUTIONSee the MORE INFORMATION section below for a possible workaround. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual FoxPro 6.0. MORE INFORMATIONA command button with a Default property set to .T., appears with a darkened border. It also responds as if clicked when you press the ENTER key when focus is on another control, such as a text box. Steps to Reproduce Behavior
This following program demonstrates this behavior. You issue a GotFocus() in the GotFocus() event for the text box and edit box, to cause the intrinsic behavior to occur, then you set the default button. In this case, the default button actually changes. Sample Code
A potential workaround, which is likely to be difficult to implement, would
be to use code like the preceding code to manage your default command
buttons. Keep in mind that the intrinsic GotFocus behavior does the reset,
so the GotFocus() event for all controls, even those which do not set a
command button to default, causes the reset to occur. A workaround would
involve adding code to all control's GotFocus() method to find and store
the current default button, issue a DoDefault(), and restore the correct
default button. However, the DoDefault() function only works in Visual
FoxPro 5.0 and later versions.
Code similar to the following could be added to the GotFocus() method for all controls on a form for a workaround: Sample Code
Note that this assumes that any default command buttons are directly on the
form, and not in a non-form container such as a container or page. It fails
to find a command button not directly on the form.
REFERENCES© Microsoft Corporation 1998, All Rights Reserved. Additional query words: kbVFp500abug kbOOP
Keywords : |
Last Reviewed: December 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |