Page 1 of 1

flashing control at mouseover

Posted: 9 Jan 2016 15:35
by marco62118
Hello

when I pass my mouse over a control that it moves 10 pixels, as the mouse does not move.
If the mouse leaves this control, this control back to its original position
But I still have a blinking control.

flashing control at mouseover

Code: Select all

predicates     onMouseMove : drawWindow::mouseMoveListener. clauses     onMouseMove(_Source, Point, _ShiftControlAlt, _Buttons):-                         move=false,!,                   getPosition(X,Y),                 setPosition(X,Y-10),                            move:=true,                   set_timerNum().     onMouseMove(_Source, _Point, _ShiftControlAlt, _Buttons).   class facts     timerNum : timerID := erroneous.     delay : integer :=2000.     move:boolean:= false.     souris:pnt:=erroneous.   predicates     set_timerNum:(). clauses                 set_timerNum():-                 timerNum := timerSet(delay).  predicates           delayedInformation : (). clauses             delayedInformation():-                 timerKill(timerNum),                     timerNum := erroneous,                   if souris                       getPosition(X,Y),                 setPosition(X,Y+10),                 move:=false.      

This is from a French translation English, thank you for your understanding and your answers

Posted: 11 Jan 2016 9:58
by Thomas Linder Puls
I think I understand the problem ;-).

The blinking comes because you do not retrigger the delay call if the window is already moved. So if you change the code like this:

Code: Select all

predicates     onMouseMove : drawWindow::mouseMoveListener. clauses     onMouseMove(_Source, Point, _ShiftControlAlt, _Buttons):-         set_timerNum(),         move=false,         !,         getPosition(X,Y),         setPosition(X,Y-10),                   move:=true.           onMouseMove(_Source, _Point, _ShiftControlAlt, _Buttons).
Then I believe the blinking will stop.

But actually it seems that you should register mouse enter/leave listeners instead:

Code: Select all

/* mouse hover and leave handling */ predicates     addMouseLeaveListener : (mouseLeaveListener OnMouseLeave).     % @short Set a leavelistener (see msdn trackMouseEvent)     % @details The listener is cleared after the event. There can be only one such listener.     % @end   predicates     removeMouseLeaveListener : (mouseLeaveListener OnMouseLeave).     % @short removes the mouse leave listener.     % @end   predicates     addMouseEnterListener : (mouseEnterListener OnMouseEnter).     % @short Set a leavelistener (see msdn trackMouseEvent)     % @details The listener is cleared after the event. There can be only one such listener.     % @end   predicates     removeMouseEnterListener : (mouseEnterListener OnMouseEnter).     % @short removes the mouse enter listener.     % @end

Posted: 14 Jan 2016 15:22
by marco62118

Posted: 16 Jan 2016 17:45
by dominique f pannier
Hi Marco,
I can not find assistance for predicates: addMouseLeaveListener , removeMouseLeaveListener .....
in vip they do not exist!
You should look at this adress on your machine : "C:\Program Files (x86)\Visual Prolog 7.5\doc\vip.chm"
If you launch this help file, you'll find these predicates.

I added a little example of what they do and how they run when the mouse is entering and leaving the control.

Posted: 18 Jan 2016 17:28
by marco62118
thank you very much

I had the version 7.3 of Visual Prolog. To which these "listener" does not exist!

I corrected many errors generated by the new version.
I can test the two new "listener".

I will keep you notified