Microsoft KB Archive/278611

= PRB: Sheridan Command Button Click Event Is Raised in WhatsThisMode =

Article ID: 278611

Article Last Modified on 8/23/2002

-

APPLIES TO


 * Microsoft IntelliPoint 4.12
 * Microsoft Optical Mouse
 * Microsoft Wireless Optical Mouse 1.0
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q278611



SYMPTOMS
The Click event of a Sheridan command button fires when it tries to retrieve the WhatsThisHelp property on the button. The Click event should not be raised when WhatsThisMode is active.



RESOLUTION
The MouseDown event of the Sheridan command button does not fire when a Form is in WhatThisMode. To work around the problem, set a flag when the MouseDown event of the command button does fire. Check the flag in the Click event of the button to determine if code has to be run.



MORE INFORMATION
This problem has been reproduced with version 1.0.41.0 of the Sheridan 3D Controls library (Threed32.ocx).

Steps to Reproduce and Work Around the Behavior
 Create a new Standard EXE project in Visual Basic. Form1 is created by default. In the Properties window, set the MaxButton and MinButton properties of Form1 to False. In the Properties Window, set the WhatsThisButton property of Form1 to True. On the Project menu, click to select Components, select Sheridan 3D Controls, and then click OK. Add an SSCommand control to Form1.  Paste the following code into the code window of Form1: Dim blnFireEvent As Boolean

Private Sub Form_Load blnFireEvent = False End Sub

Private Sub SSCommand1_Click If blnFireEvent Then MsgBox &quot;Execute the click event code&quot; blnFireEvent = False Else MsgBox &quot;WhatsThisMode is active&quot; End If End Sub

Private Sub SSCommand1_KeyDown(KeyCode As Integer, Shift As Integer) ' The keyboard was used on the button. ' Set the flag to execute the code. blnFireEvent = True End Sub

Private Sub SSCommand1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Because the MouseDown event was raised, WhatsThisHelp is not active. ' Set the flag to execute the code. blnFireEvent = True End Sub </li> Run the project. Click SSCommand1, and note that a message box is displayed indicating that you should execute the click event code.</li> Dismiss the message box.</li> Enter WhatsThisMode by clicking on the WhatsThisHelp button at the upper right of Form1.</li> Click SSCommand1, and note that a message box is displayed indicating that you are in WhatsThisMode.</li></ol>

Additional query words: WhatsThis Mode

Keywords: kbforms kbprb kb3rdparty kbctrl kbactivexevents KB278611

-

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

© Microsoft Corporation. All rights reserved.