Mouse events...

I need the events that are thrown when the mouse moves over and moves out from any visual object
Who is Participating?
gajender_99Connect With a Mentor Commented:
every time you move a mouse it throws these it trigger mosuemove event and passes these values
(unsignedlong flags, integer xpos, integer ypos)


sandeep_patelConnect With a Mentor Commented:
as gajendra told there is only mousemove event. In pb this event is defined only for window only. But if you want same event for other objects like command button, datawindow then...

1) go to the script editor for that object and select (new event) from event list.
2) give ue_mousemove to the new event.
3) assign pbm_mousemove event id for that event. It will automatically assign parameters and return type.
4) Now you can write your logic of mousemove for this object.

You can use parameters xpos and ypos with the combination of this.x, this.y, this.width and this.height as per your requirement and can achieve the functionality of mouse enter and mouse out.

gafoor78Connect With a Mentor Commented:

yes..u can create user event with event id pbm_mousemove for mouse move in the control.

but it will trigger all the time u move mouse over any part of the control. that means it will trigger many times. i think u may require to execute the code only once when even if mouse moves over the control many times without moving out.

also u cannot trap mouse out with  this.x, this.y, this.width and this.height with mousemove event ( bcos once the mouse is out of the control, mousemove event over that control will not occure)..

 u can try this to stimulate mouse over and mouse out

1. create mousemove event for ur control by creating user event with pbm_mousemove event id, say ur controls is p_1 and ur window is w_1

2. create an instance  boolean variable, say  ib_mousemove = false

4. script in the mousemove event of ur control

  if not ib_mousemove then // restricts code to execute only once
      ib_mousemove = true
     // put ur mouse over code here

 end if

5. and in the mousemove event of ur window put this code

 if  ib_mousemove then // mouse out of the control after coming over

    ib_mousemove = false

   //put ur mouse out code here

end if

6. if ur control is over any other control like command button inside a datawindow control, then u hav to do the coding 4 mouse out in the datawindow also.

7. and if ur control is over other two controls, then do in two other controls also...such case u can use an interger instance variable with some number values.

i think u will understand what i said...if u hav any clarification then let me know

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

srikanth_aConnect With a Mentor Commented:

The best way is to put a messagebox on the  messagerouter event and see what are the windows events that are fired when the mouse movement takes place.

Hi srikanth

I tried to findout event id of a static text's mouse out event for my application thru the controls's other event...but i failed to findout.....

so can u check and findout the same for me...

Apart from  named mouse events, rest of the events which are not mapped in PB will occurin the other events.

Put a messagebox in the events and you should be able to get the ID's of it.
This is the simple version.

To be more specific  - Use of PFc should help.

Hi srikath

i know it is that the events that are not mapped by PB will go thru other event...

what i meant is it is difficult to find out the correct id.. there are several events happening...and several id's are showing
i cudn't diffrentiate the correct one.

so what i asked was, if u can findout it easily, just check and let me know the correct event id value.

you can code the mousemove event in all the controls you need (eg: pbm_dwnmousemove for datawindows, pbm_mousemove for others), but in order to know what control is the current control that has the focus you could remeber the last mousemoved control on the window.


// on the window define an instance variable
Control ipo_mouseOverControl

// Code an event ue_mouseOver(control ai_ctrl)
ipo_mouseOverControl = ai_ctrl
// ...

// On each control code in the mousemove event
Window lw_parent
// Get parent window
// Notify window which control has mouse over it
iw_parent.dynamic event ue_mouseOver(This)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.