Microsoft KB Archive/162441

{| The information in this article applies to:
 * width="100%"|
 * 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.

Steps to Reproduce Behavior
 Create a Form. Place a Container on the Form. Set the Container's Visible property to to false (.F.). In the Container, place a CommandButton and a ComboBox.  Change the following ComboBox properties to the following values: RowSource = One,Two,Three RowsourceType = 1-Value LostFocus = This.Parent.Visible=.F.   In the CommandButton change the following properties: Caption = One Click Method Code: This.Parent.Visible=.F.   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.  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.
 * }

-

Last reviewed: January 21, 1997

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.