FIX: Command Button's Default Property Cannot Be Changed
Article ID: 148683
Article Last Modified on 9/30/2003
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Visual FoxPro 3.0b Standard Edition
This article was previously published under Q148683
SYMPTOMS
A command button's Default property is set to true (.T.), and it can't
be set back to false (.F.). This Results in a command button that fires its
Click event whenever the user presses the ENTER key anywhere on the form.
This problem occurs when all of the following are true:
- Another form in the form set is called from the Click event of a command
button.
- The command button is not the first object in the Tab order.
- The form that is being called has its Visible property set to false.
WORKAROUND
Here are two possible workarounds:
- Pull the "called" form from the form set, and make it a stand-alone
form. Then call it from the Click event of the command button with a
DO FORM command.
-or-
- If the form set must stay intact, set the Visible property of the
"called" form back to true (.T.), which is the default. Set its Top
property to a very high negative value such as -500. Then in the
"called" form's Show method, set the Top value back to an appropriate
value such as 12, and in the Hide method, set the Top value back to the
high negative value. This effectively keeps the form hidden until the
application is ready to present the form and then rehides it.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. This problem has been fixed in
Visual FoxPro 5.0 for Windows.
Keywords: kbbug kbfix kbvfp500fix KB148683