PRB: MouseMove Events Fires on Disabled Control in VFP

Last reviewed: September 15, 1997
Article ID: Q173782
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a

SYMPTOMS

In Visual FoxPro 3.x and 5.x, the MouseMove event fires when you move over a disabled control. This behavior may confuse some developers because the MouseMove event does not fire on a disabled control in Visual Basic 5.0 and Microsoft Access 97.

RESOLUTION

You must write code to determine the status of the Enabled property of the object and then conditionally perform the MouseMove event method code. The following code checks if the object's Enabled property is true and if so, permits your MouseMove method code to conditionally execute.

   IF This.Enabled=.t.
      ThisForm.Command2.Visible=.f.
   ENDIF

STATUS

This behavior is by design.

MORE INFORMATION

This is the desired behavior in Visual FoxPro. Since Visual FoxPro does not automatically disable the MouseMove event of a disabled object, it offers you more flexibility in application design. If you want to emulate the behavior found in Visual Basic or Microsoft Access 97, see the RESOLUTION section above.

Steps to Reproduce Behavior

  1. Create a form that contains two command buttons.

  2. In Command1, set the Enabled property to false (.F.) and add the following code to the MouseMove event:

          Thisform.Command2.Visible=.F.
    

  3. Run the form and move the icon over the disabled command button. The MouseMove fires and the Command2 object becomes invisible.


Additional query words: MouseMove Access Visual Basic
Keywords : FxprgGeneral vfoxwin
Version : WINDOWS:3.0,3.0b,5.0,5.0a
Platform : WINDOWS
Hardware : x86
Issue type : kbprb


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: September 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.