Microsoft KB Archive/190038

= BUG: Windowless OptionButton Events Not in Correct Order =

Article ID: 190038

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q190038



SYMPTOMS
The events of a Windowless OptionButton do not fire in the correct sequence when navigating with ARROW keys.



RESOLUTION
Use the windowed intrinsic Visual Basic OptionButton instead of the windowless (Lightweight) OptionButton control.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The proper sequence is the following order: the LostFocus event of the previous control followed by the GotFocus and Click events of the active control.

Instead, the order when navigating with the ARROW keys is the following: the Click event of the active control, then the LostFocus event of the previous control, followed by the GotFocus event of the active control.

NOTE: The Microsoft Windowless Controls are not part of the default Visual Basic installation. Please refer to the REFERENCES section below for details.

Steps to Reproduce Behavior
 Create a new Standard EXE project. Form1 is created by default. Using the Projects menu, select Components to bring up the Components dialog box. On the Controls Tab, check "Microsoft Windowless Controls." Then click OK. Add a Frame, Frame1, to Form1. Add two Windowless OptionButtons, WLOption1 and WLOption2, to Frame1.  Add the following code to Form1: Private Sub WLOption1_Click Debug.Print "WLOption1_Click" End Sub

Private Sub WLOption1_GotFocus Debug.Print "WLOption1_GotFocus" End Sub

Private Sub WLOption1_LostFocus Debug.Print "WLOption1_LostFocus" End Sub

Private Sub WLOption2_Click Debug.Print "WLOption2_Click" End Sub

Private Sub WLOption2_GotFocus Debug.Print "WLOption2_GotFocus" End Sub

Private Sub WLOption2_LostFocus Debug.Print "WLOption2_LostFocus" End Sub  Run the Project.</li> Click on the OptionButtons with the mouse. When the OptionButtons are navigated by clicking with the mouse, the events are fired in the proper order:

LostFocus

GotFocus

Click

</li> Use the ARROW keys to navigate between the OptionButtons. When the OptionButtons are navigated by using the ARROW keys, the events are not fired in the proper order:

Click

LostFocus

GotFocus

</li></ol>

<div class="references_section">