How to define a "OnMouseOver" event ?
Nasser
Is it possible to define a kind of "OnMouseOver" event in JavaScript ?
I mean, I have a list box, and I'd like to execute some actions when the mouse is over a row, without clicking any button.
I'd like also to return the number of the line above which is the mouse.
Thank you in advance.
Best regards,
Nasser
But in Igor's language, you can add a window hook function to the window containing the listbox, and handle MouseMoved events. You will get those events whether the mouse button is down or not. You check the eventMod member of the WMWinHookStruct input to the window hook to see if the mouse button is down or not.
Use the ControlInfo command to figure out where the listbox control is within your window.
The output from ControlInfo has enough information in it to compute what row is under the mouse. It is not a trivial programming project.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 21, 2011 at 09:48 am - Permalink
Thank you for the reply. I meant : "Is it possible to implement in Igor language an event-driven function that has the same behaviour as the JavaScript instruction "OnMouseOver"?"
Indeed, I'd like to detect when the mouse is over a listbox, without clicking any button.
Best regards,
Nasser
June 21, 2011 at 10:44 pm - Permalink
I thought that's what you really meant, but you never know. I've seen some pretty wild questions in my time at WaveMetrics!
And that is what my response addresses. There is no simple "mouse over" event that you can use inside your ListBox procedure. You have to do it with a window hook.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 22, 2011 at 09:16 am - Permalink
Now I remember an Igor example with a kind of Voltmeter, whose the needle moves in function of the mouse speed over it.
I 'll have a look on it.
Best regards
June 22, 2011 at 09:30 am - Permalink
DisplayHelpTopic "Panel Done Button Example"
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 22, 2011 at 02:05 pm - Permalink
Thank you, here is a snippet for those who want to implement such a stuff :
First, we have to install the window hook. I've written it in the function that creates the Window.
//(blablabla)
SetWindow OWLSTONE_Panel hook(MyHook)=MyWindowHook_ListBox //27-06-11
In another function :
STRUCT WMWinHookStruct &s
variable YinListbox
ControlInfo /W=MyPanel Lb1
If((s.MouseLoc.h >= V_left) && (s.MouseLoc.h <= (V_left+V_Width)) && (s.MouseLoc.v >= V_top) && (s.MouseLoc.v <= (V_top+V_Height)))
strswitch( s.eventName )
case "mousemoved":
YinListbox = s.MouseLoc.v-V_top
print floor(YinListBox/V_rowHeight)+V_startRow
break
endswitch
Endif
End
June 27, 2011 at 06:11 am - Permalink