combobox close on mouse move

S

sunilpatel

Is it possible for a combobox dropdown list to close (as if a selection was
made), if the mouse moves out of the list. I notice the pointer chances from
a cross to the normal pointer as the mouse moves off the list.

I would ideally like to mimic a mouse clixk on the top item if the mouse
moves off the list.

Hope this is clear


Thanks
 
J

jamescox

You may get a better answer, but I don't think you can use the
_MouseMove to get what you want.

You can experiment with the events of a combobox by creating one on a
worksheet and then creating the event subs for the events you want to
learn about. At the top of the worksheet code put:

Public lEvent as Long

Then add to to the event sub some code like:

Private Sub ComboBox1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)

lEvent = lEvent + 1
Debug.Print "mouse moved " & CStr(lEvent)

End Sub

Then, postion the VB IDE Immediate window where you can see it and
still be able to interact with the combo box on the worksheet and watch
which events your actions trigger.

In this case, the _MouseMove fires repeatedly as the mouse moves around
inside the combo box after the choices have been displayed, but stops
firing when the mouse moves out of the combobox border.

You may be able to do what you want with the _LostFocus event which
fires after the combo box has been selected and then the user clicks off
it onto a worksheet cell or some other control.

Hope this helps...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top