PRB: CommandButton Does Not Affect Visible Property

Last reviewed: January 21, 1997
Article ID: Q162441
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0
  • Microsoft Visual FoxPro for Macintosh, version 3.0b

SYMPTOMS

Attempting to set the Visible property of a Container from the Click event of a CommandButton inside a Container that contains a ComboBox causes unusual behavior. If you choose something from the ComboBox and click directly on the CommandButton, the Container disappears but the CommandButton remains. The CommandButton is now inactive. You can change the Visible property of the Container from a CommandButton located outside the Container without difficulty.

RESOLUTION

As a workaround, add the following command as the first line of code in the LostFocus event of the ComboBox:

   ThisForm.Command1.SetFocus

STATUS

Microsoft is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Form.

  2. Place a Container on the Form. Set the Container's Visible property to to false (.F.).

  3. In the Container, place a CommandButton and a ComboBox.

  4. Change the following ComboBox properties to the following values:

          RowSource = One,Two,Three
          RowsourceType = 1-Value
          LostFocus = This.Parent.Visible=.F.
    

  5. In the CommandButton change the following properties:

          Caption = One
          Click Method Code:
    
             This.Parent.Visible=.F.
    
    

  6. Place a CommandButton on the Form. Do not place this one in the Container. Change the following properties on this object to the following:

          Caption=Two
          Click Method Code:
    
             ThisForm.Container1.Visible=.T.
    
    

  7. Run the form and click CommandButton Two to make the Container appear. Next, click CommandButton One and notice the Container disappears. Click CommandButton Two. Now choose something from the ComboBox and move off the ComboBox object by pressing the TAB key. The Container, and its contents disappear. Press CommandButton Two to show the Container again. Finally, click on the ComboBox, choose a different list item, and with the mouse, press CommandButton One. The Container and the ComboBox disappear, however, the CommandButton One object remains on the Form.


KBCategory: kbprg kbprb
KBSubcategory: FxprgGeneral
Additional reference words: 3.00 3.00b 5.00 VFoxWin



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.