Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Mouse events changing the background color of labels

Posted on 2011-09-09
5
267 Views
Last Modified: 2012-06-21
I have some column headers on a continous form subform that when they are clicked on, it changes the sort order of the subform.  Pretty basic.

I would like to improve upon how they appear to the user.  What I have seen done, and would like to do, is have the background color of the label change when the mouse hovers over it.  I know how to make the color change, but I struggle with how to change it back.  In other words, if the back color of the label is white, I would like to change it to blue when the mouse is over it...then change back to white when the mouse leaves and hovers over another header which would then change to blue, etc, etc..

I can get it blue, but then it stays blue and I am not sure of what the customary way is to 'reset' it (change it back to white...)

0
Comment
Question by:snyperj
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36511247
use the mousemove of the section where the label is, by calling a sub that resets all labels background to default..
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36511264
Use the mouseover event of the detail section of your form to "reset" the color of the label(s)
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 36511306
What I have found is that in order to reset the color, you have to use the mousemove event of the section the control is in, and possibly other controls surrounding it (especially if the labels are butted up against each other).  

So what you might do is (my colors are made up).

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

    me.label1.BackColor = RGB(255, 0, 0)
    me.label2.BackColor = RGB(255, 255, 255)

End Sub

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

    me.label1.Backcolor = RGB(255, 255, 255)
    me.label2.Backcolor = RGB(255, 0, 0)
    me.label3.Backcolor = RBG(255, 255, 255)

End Sub

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

    me.label1.BackColor = RGB(255, 255, 255)
    me.label2.BackColor = RGB(255, 255, 255)
    me.label3.BackColor = RGB(255, 255, 255)

End Sub
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36511308
there is no mouseover event for access form (afaik)
0
 

Author Closing Comment

by:snyperj
ID: 36511767
Thanks- this matches closest to what I was struggling with.  I was using the section event but my labels are very very close together and the section itself is very short.... so I don't think the event was firing.  Placing the 'reset'  within each headers code is much more cumbersome, but gives the effect I was looking for.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question