BUG: SSCommand Click Fired with Double-Click in Common Dialog (149277)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q149277 SYMPTOMS
Double-clicking a file name in a common dialog box that happens to be
displayed immediately above an SSCommand button will cause the Click event
for the SSCommand button to be fired.
WORKAROUND
This problem can be worked around in two ways. The easiest and quickest
route is to replace all SSCommand buttons with regular command buttons. The
regular command button does not show this behavior.
Another alternative is to set the enabled property of the SSCommand button
to false immediately before showing the common dialog box. If this route is
taken then a timer must be utilized to switch the enabled property of the
SSCommand back to True. If Enabled is set to true immediately after the
common dialog box returns (or even after a delay loop), the SSCommand will
still have its click event fired. The following is a step-by-step example
for this fix (this can be followed after the reproduction sample below):
- Add a single timer control to the form.
- Set these properties of the timer control:
Enabled: False
Interval: 1
- Add this code to the Timer1_Timer event:
Private Sub Timer1_Timer()
SSCommand1.Enabled = True
Timer1.Enabled = False
End Sub
- In code, add this line immediately before the common dialog is shown:
SSCommand1.Enabled = False
- Add this line of code immediately after the common dialog is shown:
Timer1.Enabled = True
This code will turn off the SSCommand immediately before showing the common
dialog box. When the dialog box returns, the timer will be enabled, its
event will fire 1 millisecond later, re-enabling the SSCommand, and then it
will turn itself off.
STATUS
Microsoft has confirmed this to be an issue in the Microsoft products
listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 6/29/2004 |
---|
Keywords: | kbBug KB149277 |
---|
|