PRB: Sheridan Command Button Click Event Is Raised in WhatsThisMode (278611)



The information in this article applies to:

  • Microsoft IntelliPoint Software version 4.1
  • Microsoft Optical Mouse Blue
  • Microsoft Wireless Optical Mouse Blue
  • Microsoft Visual Basic Professional Edition for Windows 5.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 5.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

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

  1. Create a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. In the Properties window, set the MaxButton and MinButton properties of Form1 to False.
  3. In the Properties Window, set the WhatsThisButton property of Form1 to True.
  4. On the Project menu, click to select Components, select Sheridan 3D Controls, and then click OK.
  5. Add an SSCommand control to Form1.
  6. 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 "Execute the click event code"
            blnFireEvent = False
        Else
            MsgBox "WhatsThisMode is active"
        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
    					
  7. Run the project. Click SSCommand1, and note that a message box is displayed indicating that you should execute the click event code.
  8. Dismiss the message box.
  9. Enter WhatsThisMode by clicking on the WhatsThisHelp button at the upper right of Form1.
  10. Click SSCommand1, and note that a message box is displayed indicating that you are in WhatsThisMode.

Modification Type:MajorLast Reviewed:8/23/2002
Keywords:kb3rdparty kbActivexEvents kbCtrl kbDSupport kbForms kbprb KB278611