Solved

Mouse events changing the background color of labels

Posted on 2011-09-09
5
271 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
[X]
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
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 48

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

718 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