flashing control at mouseover

Discussions related to Visual Prolog
marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

flashing control at mouseover

Unread post by marco62118 » 9 Jan 2016 15:35

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
Novice, very novice in Visual Prolog and even poorer in English

User avatar
Thomas Linder Puls
VIP Member
Posts: 1625
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 11 Jan 2016 9:58

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
Regards Thomas Linder Puls
PDC

marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

Unread post by marco62118 » 14 Jan 2016 15:22

Novice, very novice in Visual Prolog and even poorer in English

dominique f pannier
VIP Member
Posts: 98
Joined: 23 Sep 2002 23:01

Unread post by dominique f pannier » 16 Jan 2016 17:45

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.
Attachments
MouseMove.zip
(25.86 KiB) Downloaded 282 times
Regards
Dominique Pannier

marco62118
VIP Member
Posts: 88
Joined: 16 Feb 2011 19:21

Unread post by marco62118 » 18 Jan 2016 17:28

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
Novice, very novice in Visual Prolog and even poorer in English

Post Reply