Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Mouse events changing the background color of labels

Posted on 2011-09-09
5
Medium Priority
?
273 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 earned 2000 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

618 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