OnClick preceding OnEnter

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

VS 2005 w/SP1 / XP Pro w/all service packs

One of our forms has a Tab-control onto which is dynamically added a
number of other controls. When the added controls are ComboBoxes or
CheckListBoxes, their OnClick event is fired before their OnEnter. For
other controls on the Tab (e.g. ListBox) the events occur in the
expected order -- Enter and then Click. On other forms where the
controls are added to a Tab-control at design-time, the Enter / Click
also occur in the expected order. Does anyone have any idea why on this
form the Click (and MouseClick) event would precede the Enter event?
 
If I had to guess, it would be related to the differences between
setting focus on those controls versus other ones.
 
Bryan:

In all cases we are setting focus by clicking on the control with the
mouse.

As a point of clarification... When I wrote OnClick and OnEnter I
really meant the Enter and Click events; we are not overriding the the
On*** methods.

For a ComboBox the problem manifests itself as follows: The first time
the control's selection-arrow is clicked nothing happens; the second
and subsequent times click the selection-arrow causes the drop-down
list to appear. The drop-down list should appear *every* time the
selection-arrow is clicked.
 
Solution:

In the Click-event, if and only if the Enter-event has not been
entered, set the DroppedDown property to True.
 
Back
Top