LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I identify which control is being hovered over?

Hello all,

 

I have a simple feature of my code I am working on. I want to have a detailed help box ( a little more detailed than the tooltip popup option) with instructions I want to print on my screen.

The idea is that when I have an active control, the instructions will print in a small text box to give people guidance on my program.

This works for half of what I want to do.

 

But  in the case of a custom toolbar, I do not have that ability since I cannot click inside of it like a textbox.

I am using the tooltip, but I would like to be able to print a better, more detailed message in my help box.

 

Ideally what I would like to know if there is a function to be able to get which control is being highlighted or hovered over by panel and control id.

 

It's no big deal if there isn't one, but now I am curious.

Veni Vidi Duci
0 Kudos
Message 1 of 4
(4,630 Views)

Hi,

 

if EVENT_GOT_FOCUS is not suitable for you another possibility could be to use a timer callback, and for every timer tick call GetRelativeMouseState (panel, 0, &x_coordinate, &y_coordinate, NULL, NULL, NULL); this will return the current position of the mouse cursor on the panel. To make use of it, at the beginning of your program you need to obtain the positions of your UI controls, e.g. using GetCtrlBoundingRect ( panel, control, &button.top, &button.left, &button.height, &button.width ). Then you need to check if the mouse is within a bounding box by comparing the mouse coordinate with the control coordinate...

 

But why are the tooltips not working for you?

0 Kudos
Message 2 of 4
(4,622 Views)

Sounds interesting. I shall try the Event Got Focus first and go from there.

 

It's not the tooltips aren't working. They work fine. I just, visually, want all my help details in a help box on my GUI. Its preferential is all.

Veni Vidi Duci
0 Kudos
Message 3 of 4
(4,589 Views)

There is also an EVENT_MOUSE_POINTER_MOVE event.

Focus events need a click to occur.

Move event is fired when mouse pointer is over a control.

But since it is not displayed in the UIR editor in Operate mode, I cannot tell if it works for menus or not.

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 4
(4,580 Views)