Mouse over actions

octatyan

Registered User.
Local time
Today, 10:00
Joined
Jan 10, 2003
Messages
36
I have a label that appears when the mouse cursor moves over a button by adding code to the On Mouse Move property.

How do I make that label disappear when the mouse cursor moves off the button?
 
Try writing the reverse code in the Detail section MouseMove Event.

That's the simple answer but it will needlessly fire the MouseMove Events hundreds of times per second when moving over the Detail section or within any given Label.

The attached demo employs a fair bit more code but reduces Event processing dramatically.
There is also a counter to show the number of calls to the common MouseMove Event.

Edit to add:
The idea of storing the last highlighted Label came from Timbuck2 at Utter Access.

Regards
Chris
 

Attachments

Last edited:
That's the simple answer but it will needlessly fire the MouseMove Events hundreds of times per second when moving over the Detail section or within any given Label.
Interesting sample to illustrate the counting of the MouseMove event. I find that the MouseMove event in the detail section is only called once and the MouseMove event for the next object is only called once when activated.

I have been using the MouseMove event for the same type of reactions within my db's and I have not experienced any adverse affects.

Here is a sample that I have posted before that demonstrates the MouseMove events.
 

Attachments

Ghudson

Your method of achieving that is extremely devious and clever. :cool:

(I won't say how you did it because it warrants, for the moment, time for others to think about.)
(Nor can I say why there is no ToolBox available for me to try and verify the number of Event handlers being executed. But I will look again in the morning.)

One thing that comes to mind though: -
If we wanted more than a MouseOver, and cursor changing to hand, for more than a normal number of controls, let's say 300, could we and would we do it the same way?

Please let me say, you are a clever and devious bastard, in the best sense of the word. :D

Getting late here but, in the morning, I will try to write something that better explains my poor fragile position.

Kind regards
Chris
 
;)

In the attachment, note the MouseMove Events firing as you move over the rectangles.

Regards
Chris
 

Attachments

ChrisO, there are no forms in the attachment you posted.
 
:D

That's because I'm a devious bastard too. ;)

Try running the Sub.

Regards
Chris
 
Don't know what's going on with the devious bastard stuff but I'll pretend like I do and add a comment:

Chris's code is clever in that it efficiently fights screen flicker (which may occur when using the mouse move event for the detail area of your screen) because it "turns off" the mouse move function when it's no longer needed.

Not to say I didn't enjoy and appreciate ghudson's FunWithButtons too -- because I did.

Thanks to both of you bastards.

Regards,
Tim
 
Hey Tim…

Thanks to both of you bastards.
Where's the smiley? :D

Did you figure how ghudson produced the Hand Over?
That's what I thought was devious. :cool:

I guess ghudson has gone to find some Form. ;)

Regards
Chris
 
Chris,

Smiley? Why?

Just kidding!

ghudson's trick: The space bar in the hyperlink? It leaves a blank control tip, however. And yet this can be "fixed" by actually putting something in the control tip text prop.

Thanks again for the code sample.

Regards,
Tim
 
ghudson's trick: The space bar in the hyperlink? It leaves a blank control tip, however. And yet this can be "fixed" by actually putting something in the control tip text prop.
I am guessing that you must be using Access 2002 if you see a blank control tip. Not a problem with Access 97 but you correctly mentioned the fix. ;)

That's because I'm a devious bastard too.
Try running the Sub.
I was too tired to do the obvious. Tried it and now I have the urge to play a game of checkers. :o Good night!
 
Tim…

---------------------------------------------

Yes we know you are just kidding.
But sometimes in the written word the intention does not come across quite so clearly.
That's the only reason I mentioned it.

In Australia, it is a term of endearment to call someone a clever, devious, old and/or blah, blah, blah bastard. (Except silly old bastard... in which case it is probably a fact, but even then it is almost impossible to offend a true Australian. [This is one thing that did not come across it the Water Cooler! {So much talk with so little point. :confused: }])

Without knowing your location…you will have a hard time offending me, but you are at liberty to try. :D
(Having said that, I simply hope like hell I don't offend others… unless of course I try. ;) )

Back to more technical matters;

The last demo I posted "Four_Hundred_Rectangles.mdb" does not produce screen flicker under my circumstances, A97 and Win2K. But it does do something quite remarkable and/or unexplained.

Under my circumstances if I open the Form everything is as expected. Vast numbers of the Event handler being called as the mouse is moved over the Rectangles.

But that is nothing to this: -

Run the Subroutine that builds the Form.
Open the Form.
Give the computer the 'three finger salute"
Select the Task Manager/Performance Tab"
Move the cursor back over the Rectangles.

The demo shows approx. 1000 Event Handler calls per second.
CPU usage goes to 100% and stays there.
Memory Commit Charge does not bloat.

Access under these circumstances consumes 100% of CPU time but does not bloat, as it does sometimes.

I have read about the problem concerning the mouse in A97 under Win2K, but this seems like something else again. The reported problem with the mouse in A97 under Win2K is benign. That's fine!

But without knowing the technicalities, it seems prudent to switch off Event Handlers when they are not required.

---------------------------------------------

ghudson…

Good night!

---------------------------------------------

Kind regards
Chris
 
No sweat, Chris. I understood the diction, enjoyed your sample, so I chimed in. And, yes, I know you knew that I was kidding -- I only added the "I'm kidding" in case someone from Kayla Kayla was browsing the forum (Kayla Kayla is a small island in the Indian ocean where people don't laugh on Tuesdays and Wednesdays; and they are deeply offended if you do anything to make them laugh without admitting up front that you are kidding. Subtle, I know. Ironically, for the rest of the week, Kaylas continually play practical jokes on one another).

Will take a closer look at your rectangle sample. Thanks for glossing it.

Regards,
Tim
 
Under the circumstance I would recommend this: -

Kayla's, Kaylaeans, Kowaliars (bugger the spell checker) Koalas may not work Tuesdays and Wednesdays… but I do all week round (All Tuesdays and Wednesdays, well most of them.)

Subtle, I know. Ironically, for the rest of the week, Kaylas (Koalas) continually play practical jokes on one another.
I'll have a subtle word with our immigration Minister but, under the circumstances, I think Australia can assimilate Koalas in much the same way that Coke has assimilated everything else into the US. ;)

Regards
Chris
 
Last edited:
ChrisO said:
Tim…

. [This is one thing that did not come across it the Water Cooler! {So much talk with so little point. :confused: }])

Chris
kettles and pots :confused:
 
Rich

"kettles and pots… "

That is a difficult question and this is a difficult reply.

I see it as a difficult question because, to me, it is too brief.
If it is a rhetorical question, then I do not understand.

If it is a real question then maybe I did not specify to which thread of the Water Cooler I was referring.
If the question is not reasonable then, as far as I can understand, the answer could not be specified.

Above all else, in my view...

This thread is throwing about quite a bit of code, in the best possible way.
Everyone has tried to do it with a sense of humour.

Please let us try to keep it that way…

Chris
 
As you've already intimated, different cultures have different senses of humour, it was a jibe, nothing else ;)
 
Is it possible to use that Bold On Mouse Over example on option button labels, and if so, can someone please lead me in the right direction :)

dh
 
G’day Darrell

“Is it possible to use that Bold On Mouse Over example on option button labels…”

No, but the revised attachment does…

The problem with Labels attached to Option buttons, or anything else, is that they do not have of themselves a MouseMove event.

The simplest way to overcome this is to detach the Label, then it has a MouseMove event.

However, don’t you just hate that word, if we detach the Label from its Control it has no affect on a Control simply because it has no Control. Sounds simple…but it ain’t

The logic would seem to mean: -
For the Label to have some affect on its Control it must be attached to its Control. TRUE.
If it is attached to a Control it hase no MouseMove event. TRUE
Ergo: If the Label is attached to a Control there is no MouseMove event to highlight it. FALSE.

The revised attachment has been modified to do just that, to make Ergo FALSE.

I’m not saying that it is simple, it isn’t and wasn’t to write it, but it does work...

Regards
Chris
 

Attachments

Users who are viewing this thread

Back
Top Bottom