MouseMove problem with continuous form on tab control

S

Steve Jensen

I am trying to use the MouseMove event to set the ControlTipText property of
a combo box on a continuous form, which is on a tab control.

Private Sub EventID_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me.EventID.ControlTipText = Me.txtEvent.Value
End Sub

The event just sets the ControlTipText to the value of a hidden text box.

The ControlTip part works; however, the event seems to preempt all other
events, including the normal functioning of the combo box. When you open the
screen, all instances of the combo box flicker, as if some endless processing
was occurring (even when there is not a mouse over any of them). If you
select a record, the flickering stops, and the MouseMove event seems to work
fine.

However, if you try to click the dropdown for the combo box, the list either
flashes on and disappears, or it appears but seems to be locked - you cannot
select a value from the list.

What can be done to correct this problem?
 
M

Marshall Barton

Steve said:
I am trying to use the MouseMove event to set the ControlTipText property of
a combo box on a continuous form, which is on a tab control.

Private Sub EventID_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me.EventID.ControlTipText = Me.txtEvent.Value
End Sub

The event just sets the ControlTipText to the value of a hidden text box.

The ControlTip part works; however, the event seems to preempt all other
events, including the normal functioning of the combo box. When you open the
screen, all instances of the combo box flicker, as if some endless processing
was occurring (even when there is not a mouse over any of them). If you
select a record, the flickering stops, and the MouseMove event seems to work
fine.

However, if you try to click the dropdown for the combo box, the list either
flashes on and disappears, or it appears but seems to be locked - you cannot
select a value from the list.


The Mouse Move event can fire frequently, which can
interfere with the more common control operations). So you
should avoid doing anything that does not need to be done.
In your case, that means don't set the property if it's
already been set.

In fact, I think you should examine how the hidden text box
gets it value and use a related or the same event to set the
ControlTipText (and do away with the MouseMove event
altogether).
 
S

Steve Jensen

I agree - I'd rather not use this event at all; however, I don't see another
one that will set the ControlTipText without actually selecting a record and
making it current.

I did modify the code thus, which seems to have reduced the problem:

If Me.EventID.ControlTipText <> Me.txtEvent.Value Then
Me.EventID.ControlTipText = Me.txtEvent.Value
Else
DoEvents
End If

There is a tendency now for the dropdown list to disappear sometimes when
the user moves the mouse down to select something from the list - position
becomes a touchy thing, apparently; however, I think I can live with that.

Thanks for the help.
 
M

Marshall Barton

How does the value in txtEvent get set? If it's bound to a
record source field, why not set the ControlTipText in the
Current event?

Why do you have the DoEvents in your code?
 
S

Steve Jensen

It gets set from a hidden text field. This is a continuous form, with no
room to display the text field in its own column. I don't use the Current
event because that would require the user to select each record in the form
in order to see the controltip text. If they were going to do that, they
might just as well click the dropdown because the value is in one of the
combo box columns.

I put DoEvents in just to make sure that other events on the form are
allowed to process, but I have tried it both ways and there is no difference
in behavior so I will take it out.

Marshall Barton said:
How does the value in txtEvent get set? If it's bound to a
record source field, why not set the ControlTipText in the
Current event?

Why do you have the DoEvents in your code?
--
Marsh
MVP [MS Access]


Steve said:
I agree - I'd rather not use this event at all; however, I don't see another
one that will set the ControlTipText without actually selecting a record and
making it current.

I did modify the code thus, which seems to have reduced the problem:

If Me.EventID.ControlTipText <> Me.txtEvent.Value Then
Me.EventID.ControlTipText = Me.txtEvent.Value
Else
DoEvents
End If

There is a tendency now for the dropdown list to disappear sometimes when
the user moves the mouse down to select something from the list - position
becomes a touchy thing, apparently; however, I think I can live with that.
 
M

Marshall Barton

Steve said:
It gets set from a hidden text field. This is a continuous form, with no
room to display the text field in its own column. I don't use the Current
event because that would require the user to select each record in the form
in order to see the controltip text. If they were going to do that, they
might just as well click the dropdown because the value is in one of the
combo box columns.

I put DoEvents in just to make sure that other events on the form are
allowed to process, but I have tried it both ways and there is no difference
in behavior so I will take it out.


Did removing the DoEvents reduce the undesirable effects?

If you have not dug through Stephen Lebans' ToolTip class,
take a look to see how he did this kind of thing. There
just might be something you can use somewhere in it.
http://www.lebans.com/tooltip.htm
 
S

Steve Jensen

Taking off DoEvents made no difference. It works OK, except that when you
click the dropdown and try to move the mouse straight down (over the combo
control) the list disappears. You have to move the mouse to the right with
the list showing, then move down after the mouse is clear of the combo box in
order for the list to stay there so you can select something. So until I can
clear that up I probably won't use the MouseMove event.

I'll check the link you provided.
 
S

Steve Jensen

I have looked at lebans' tooltip solution, and can see a good use for it in
other situations; however, it does not appear to work with continuous forms,
and I am not enough of a programmer to dig into his classes to figure out how
to do it.
 

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