Microsoft KB Archive/194612

= FIX: AlwaysOnTop Property Always Returns .F. For TopLevel Forms =

Article ID: 194612

Article Last Modified on 3/7/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q194612



SYMPTOMS
You can use the AlwaysOnTop property of a Visual FoxPro form in conjunction with a TopLevel form to create an application that prevents other windows from covering the applications window. Changing the AlwaysOnTop property at run-time changes the behavior of the form, but querying the property value always returns .F. This behavior only exists when the ShowWindow property of the form is set to 2 - As TopLevel Form.



RESOLUTION
You can use a custom property and an AlwaysOnTop Assign method to work around this problem. The following code uses a custom form property called AlwaysOnTop_Actual to store the actual setting of the AlwaysOnTop property of the form. The value of this custom property changes in the AlwaysOnTop_Assign method: PUBLIC ox     ox = NewObject("test") ox.Show ?ox.AlwaysOnTop_Actual ox.AlwaysOnTop = .F.     ?ox.AlwaysOnTop_Actual ox.AlwaysOnTop = .T.     ?ox.AlwaysOnTop_Actual

DEFINE CLASS test AS form ShowWindow = 2 AlwaysOnTop = .T.     AlwaysOnTop_Actual = .T.

PROCEDURE AlwaysOnTop_Assign LPARAMETERS vNewVal This.AlwaysOnTop_Actual = vNewVal THIS.AlwaysOnTop = m.vNewVal ENDPROC

ENDDEFINE



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
Run the following program code: PUBLIC ox     ox = NewObject("test") ox.Show ?ox.AlwaysOnTop ox.AlwaysOnTop = .F.     ?ox.AlwaysOnTop ox.AlwaysOnTop = .T.     ?ox.AlwaysOnTop

DEFINE CLASS test AS form ShowWindow = 2 AlwaysOnTop = .T.  ENDDEFINE Note the querying the AlwaysOnTop property always returns .F.

Keywords: kbbug kbfix kbvs600sp3fix KB194612

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.