RE: Mouse-Over State on Graphic Button
- From: "Greg Wilson" <GregWilson@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 17 Nov 2005 21:17:02 -0800
Thanks for the feedback Vic.
Point of interest perhaps: This may be stating the obvious, but when a
keyboard key is remapped using Application.OnKey, when that key is held down,
it repeatedly executes the assigned macro. The effect is similar to rapid
polling but offers control at the same time. But of course you have to know
to press the key. So it's not convenient or appropriate for all situations. I
have yet to use this to any great extent but plan to experiment when I have
more time.
Currently, I use this in only one project in conjuction with GetCursorPos
and RangeFromPoint where I remapped the arrow keys and use them to cotinually
move the object (picture) that is under the mouse pointer. In this situation,
I don't want to activate the picture (the arrow keys support this already for
activated shapes). The process is very smooth with no flicker, at least on my
computer. I was thinking it could be used, as you also mentioned, for charts,
and perhaps avoid the flicker associated with MouseMove or MouseDown.
As for your code, I'm considering using Workbook_SheetActivate event to
start and stop it and would probably limit its use. There are of course
situations where you want this automatic functionality. Definately a keeper.
Regards,
Greg
"Vic Eldridge" wrote:
> I'm glad you found another use for it Greg. It goes to show that the rapid
> polling concept can be used to plug all sorts of gaps in Excel's object model.
>
> I particularly like it when used in conjunction with GetCursorPos and
> RangeFromPoint, providing us with all those mouse movement type events that
> many of us have longed for. I hazard a guess that throwing GetAsyncKeystate
> into the mix could provide mouse button events too. RangeFromPoint can
> return ChartObjects too, so using it in conjunction with the GetChartElement
> method could produce some really cool chart effects.
>
> I adapted the code from the following post by Jaafar,
> http://groups.google.com.au/group/microsoft.public.excel.programming/browse_frm/thread/372b44f8ee8e8937/
> In that example, the same concept is used to monitor MouseEnter and
> MouseExit events at a cell based level.
>
> > Do you know if there is a performance problem when it is running with large
> > projects or other issues?
> In my experimentations I've seen Excel crash a couple of times (I'm not sure
> why), and as you noticed, MsgBoxes pose a bit of a problem. Best practice
> would be to stop the timer before running any other code, then start the
> timer again when the other code is finished. Typically though, once the code
> is fully debugged it seems to chug along quite happily. I would still
> recommend using it as sparingly and as carefully as possible.
>
> Regards,
> Vic Eldridge
>
>
>
> "Greg Wilson" wrote:
>
> > Great contribution Vic !!!
> >
> > I just checked it out. Looks like it could be the solution for the missing
> > "Worksheet_ScrollChange" event - i.e. capture the event of scrolling the
> > work***. Example:
> >
> > Sub TimerProc()
> > Static ScrRw As Long
> > With ActiveWindow
> > If .ScrollRow <> ScrRw Then Range("A20") = .ScrollRow
> > 'Note: DON'T CALL A MESSAGE BOX or will freeze !!!
> > ScrRw = .ScrollRow
> > End With
> > End Sub
> >
> > Do you know if there is a performance problem when it is running with large
> > projects or other issues?
> >
> > Regards,
> > Greg Wilson
.
- References:
- RE: Mouse-Over State on Graphic Button
- From: Vic Eldridge
- RE: Mouse-Over State on Graphic Button
- Prev by Date: Re: range variables for chart x axis values
- Next by Date: Re: How do I set formula?
- Previous by thread: RE: Mouse-Over State on Graphic Button
- Next by thread: Spinbutton won't stop counting
- Index(es):