Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Mouse Move and On Click Conflict

Status
Not open for further replies.

DomDom3

Programmer
Jan 11, 2006
59
GB
Hi there,

I have a label control on a form, when clicked it opens another form.

Code in the On Mouse Move event underlines the label when the mouse moves over. The underline is on a timer so after 0.5 seconds the underline disappears.

The problem i have is that when the the mouse moves over the label to open the form the On Mouse Move timer is started and is midway when the On Click event starts, when the timer has finished the form initial form with the label is no longer open so the code errors.

I guess I need to add some code to the on click event to stop the on mmouse move sub running. Can anyone advise on the code required?

(The reason the timer is used is that otherways of removing the underline such as on mouse move of the form's detail creates the annoying flashing with the label.)

Thanks

 
Hi...

I tried this in simulation, I'm not seeing the flashing you described.

Private Sub Label5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Label5.FontUnderline = True

End Sub



Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Label5.FontUnderline = False
End Sub
 
I know about the flashing, it's very annoying, but you can get rid of it by the CAREFUL usage of application.echo

basically turn echo off at the start of the routine you use to get rid of the lines, then make absolutely sure you turn it back on when the routine finishes...

anyway, to answer your question, in your timer event, where you remove the underline, you can test wether the form in question is loaded or active and if not, then don't try to remove the underline...

you can do this by using the application.allforms collection and the screen object...

--------------------
Procrastinate Now!
 
Lewds,

Thanks for looking, the flashing/flickering is a widely recognised "feature" of Access, it can be quite temperamental though which may explain why you couldn't replicate it.


Crowley16,

The application.echo was a useful line of enquiry, I couldn't get it to work though, it caused all sorts of peculiar flashing, perhaps I didn't put the code in the correct place, but I'm sure it will come in useful in the future.

I did resolve the problem in the end by putting a box round the labels then using the On Mouse Move event of the box to remove the underline. So far there's no flashing and all seems to work so my fingers are crossed.

Thanks for your help...



 
How are ya DomDom3 . . .

Instead of using the timer, use the [blue]On Got Focus/On Lost Focus[/blue] events to set/reset the underline! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 

Aarggh, the flicker has returned.

I added the box and used its On Mouse Move event but because the box in the centre of the form, when the form opens the mouse pointer is in the box and so the On Mouse event is triggered which causes the flickering again.

AceMan, thanks for looking...

Because I'm using labels as psuedo command buttons I don't have the Got Lost Focus event options.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top