Microsoft KB Archive/141911

= PRB: Form with DeskTop=.T. Changes the Left or Top Properties =

Article ID: 141911

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 Q141911



SYMPTOMS
With the DeskTop property set to True (.T.), the Top and Left properties of a form may change if the form is moved programmatically.



WORKAROUND
In the control that is used to move the form, the Left or Top properties of the form must subtract twice the original form position value from the new form position. Please see the "More Information" section for an example workaround.



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



Example One
 Create a form, and set its DeskTop property to true (.T.). Run the form and in the Command window type:

.Left = 100



The form will move to position 100 but the form will also move up.

NOTE: A similar behavior occurs if, after the form is visible, the FoxPro desktop is moved and the form's Top property is changed. The form's Left property will be affected.

Example Two
  In the form's Click event, place this code: ThisForm.Left = ThisForm.Left + 100  Run the form, and note that the Example One behavior is exhibited. Create two new properties for the form:

<ul> OrgLeft to hold the form's original Left property.</li> OrgTop to hold the form's original Top property</li></ul> </li>  In the form's Init event, place this code: This.OrgLeft = This.Left This.OrgTop = This.Top </li>  Add a "Move to the Right" command button with the following code in its Click event: ThisForm.Top = ThisForm.Top - (2*ThisForm.OrgTop) ThisForm.Left = ThisForm.Left + 100 - (2*ThisForm.OrgLeft) NOTE: This moves the form 100 pixels to the right of its current position. </li>  Add a "Move to the Bottom" command button with the following code in its Click event: ThisForm.Top = ThisForm.Top  + 100 - (2*ThisForm.OrgTop) ThisForm.Left = ThisForm.Left - (2*ThisForm.OrgLeft) NOTE: This move the form 100 pixels to the bottom of the current form position. </li> Run the form and observe the behavior.</li></ol>

Additional query words: VFoxWin

Keywords: KB141911

-

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

© Microsoft Corporation. All rights reserved.