By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,163 Members | 976 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,163 IT Pros & Developers. It's quick & easy.

How to create a "un- On Mouse Move" event?

100+
P: 176
It's an interesting question, as I see it.

I have a form, in which there are a few command buttons, which change color when the mouse is on top of them (On Mouse Move). Now, I want the color to be changed back to normal when the mouse moves away from the command's button area. The only way I have figured up untill now how of to do it, is having a big text box around the command buttons area, which is sent to back, and to have On Mouse Move event on it too. Problem is, that the text box has to be visible in order for this to work, and so if a user will accidently click on the text box area, it will become white - editing mode, and will conceal the command buttons, plus the curson blinker will apear, which is not asthethic.

Any creative thought on how to make this work?
Thanks :)
Dec 31 '06 #1
Share this Question
Share on Google+
7 Replies


ADezii
Expert 5K+
P: 8,669
It's an interesting question, as I see it.

I have a form, in which there are a few command buttons, which change color when the mouse is on top of them (On Mouse Move). Now, I want the color to be changed back to normal when the mouse moves away from the command's button area. The only way I have figured up untill now how of to do it, is having a big text box around the command buttons area, which is sent to back, and to have On Mouse Move event on it too. Problem is, that the text box has to be visible in order for this to work, and so if a user will accidently click on the text box area, it will become white - editing mode, and will conceal the command buttons, plus the curson blinker will apear, which is not asthethic.

Any creative thought on how to make this work?
Thanks :)
1) Make sure the Back Style property of the Text Boxes are Transparent
2) Set the Visible property of the Text Boxes to Yes
3) For the Text Box, Format ==> Send to Back
4) Reset the Fore Color property to the Default in the MouseMove() Event of
the Text Box
5) In the MouseDown() Event of the Text Boxes place this line of code:
Expand|Select|Wrap|Line Numbers
  1. SendKeys "{TAB}", True
This seems to work and will eliminate the White bordering area and
Blinking Cursor
Dec 31 '06 #2

100+
P: 176
1) Make sure the Back Style property of the Text Boxes are Transparent
2) Set the Visible property of the Text Boxes to Yes
3) For the Text Box, Format ==> Send to Back
4) Reset the Fore Color property to the Default in the MouseMove() Event of
the Text Box
5) In the MouseDown() Event of the Text Boxes place this line of code:
Expand|Select|Wrap|Line Numbers
  1. SendKeys "{TAB}", True
This seems to work and will eliminate the White bordering area and
Blinking Cursor
Nice indeed.
It works, although the white bordering area still binks for an instance.

Happy New Year!
Dec 31 '06 #3

NeoPa
Expert Mod 15k+
P: 31,660
Would it help to use a Label control in place of the TextBox.
This would have the benefit of being unable to receive the focus.
Nice thinking btw :)
Dec 31 '06 #4

P: 1
I'm sorry to answer on such an old post but since I found a much easier approach, I decided to share...
You can set an "On Mouse Move" event for the Detail section of the form. You would reset all buttons to the normal state there and would not need to create many different objects behind your buttons.
Apr 15 '14 #5

Seth Schrock
Expert 2.5K+
P: 2,946
Current versions of Access have a Hover Color property that does this automatically so there is no need to code it yourself. There is also the Pressed Color, Hover Fore Color and Pressed Fore color properties to allow for full color change settings without a single line of code. I had assumed that this was available for a long time, but I know it has been available since 2007.
Apr 15 '14 #6

zmbd
Expert Mod 5K+
P: 5,397
so something like this?

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub Command12_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  5.    Me.Command12.Caption = "MouseON"
  6. End Sub
  7.  
  8. Private Sub FormHeader_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  9.     Me.Command12.Caption = "MouseOFF"
  10. End Sub
  11.  
I used the header because I have a command button there and it was easy.
What I see happening though is a flicker in the command button with the mouse movement which is sort of distracting.
Apr 15 '14 #7

zmbd
Expert Mod 5K+
P: 5,397
ah, simple fix:
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private zmousein As Boolean
  5.  
  6. Private Sub Command12_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  7.     If Not zmousein Then
  8.         Me.Command12.Caption = "MouseON"
  9.         zmousein = True
  10.     End If
  11.  
  12. End Sub
  13.  
  14. Private Sub FormHeader_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  15.     If zmousein Then
  16.         Me.Command12.Caption = "MouseOFF"
  17.         zmousein = False
  18.     End If
  19. End Sub
  20.  
Apr 15 '14 #8

Post your reply

Sign in to post your reply or Sign up for a free account.