The tooltip instrument driver for CVI contains code for doing a similar thing
i.e. to display a context-sensitive text message when the mouse cursor hovers
over a control. This could be adapted to do what you want. See
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/dfd062d0bcdebc
1786256a48005fd4b3?OpenDocument
However, the tooltip code works by installing a timer that periodically calls
GetRelativeMouseState() to get the current mouse coordinates and compares them
to the panel region assigned to each control and does a table look-up to find
out what control-specific text to display for a control. This raises an
interesting question: Wouldn't it be more efficient for the tooltip driver to
capture extended mouse events as Chris just described instead of using a timer
callback and mouse state-polling to accomplish the same thing? Or is this simply
a case of, "There's more than one way to skin a mouse"?
Nick J.
"Chris Matthews" wrote in message
news:506500000005000000FBAB0000-1031838699000@exchange.ni.com...
> Oops, yes, sorry I forgot how the behavior worked. Windows messaging
> is based on window, and in CVI there are not separate windows for each
> control. Therefore, you install entended events to designate which
> control callback will get the Mouse move events, but it will get them
> for the entire panel. So, you need to setup a check for when the
> mouse moves over the control, then when it does hide the control until
> the mouse moves move off the control.
>
> Your code would look something like this (where eventData1 and
> eventData2 hold the current mouse position). This example would
> change the text of the button PANEL_GO to green when the mouse was
> over it.
>
> case EVENT_MOUSE_MOVE:
> if(isOver)
> {
> if((ctrlLeft >= eventData2) || (eventData2 >
> (ctrlLeft+ctrlWidth)))
> {
> if((ctrlTop > eventData1) || (eventData1 >=
> (ctrlTop+ctrlHeight)))
> {
> SetCtrlAttribute (panelHandle, PANEL_GO,
> ATTR_LABEL_COLOR,VAL_BLACK);
> isOver = 0;
> }
> }
> }
> else
> {
> if((ctrlLeft <= eventData2) && (eventData2 <
> (ctrlLeft+ctrlWidth)))
> {
> if((ctrlTop < eventData1) && (eventData1 <=
> (ctrlTop+ctrlHeight)))
> {
> SetCtrlAttribute (panelHandle, PANEL_GO, ATTR_LABEL_COLOR,
> VAL_GREEN);
> isOver = 1;
> }
> }
> }
>
> Best Regards,
>
> Chris Matthews
> National Instruments