Stop Group receiving multiple mouseenter
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Stop Group receiving multiple mouseenter
Hi there
My custom scrollbar and buttons are receiving multiple mouseenter and mouseleave messages when the mouse moves over different parts in the group. This results in a small flickering as I change colors on its contents to make a hover-state. How do I prevent this? I made a transparent graphic to cover all the elements in the group to stop the flickering but with this method is a little tedious when I want to edit ...
any smart solutions out there?
Sjat
My custom scrollbar and buttons are receiving multiple mouseenter and mouseleave messages when the mouse moves over different parts in the group. This results in a small flickering as I change colors on its contents to make a hover-state. How do I prevent this? I made a transparent graphic to cover all the elements in the group to stop the flickering but with this method is a little tedious when I want to edit ...
any smart solutions out there?
Sjat
Re: Stop Group receiving multiple mouseenter
Hi Sjat,
depends on what exactly should happen, I will need to take a look at your script(s)
Best
Klaus
depends on what exactly should happen, I will need to take a look at your script(s)

Best
Klaus
Re: Stop Group receiving multiple mouseenter
Hi Klaus
I made a very simple group with 2 graphic rectangles to check if its my code thats wrong.
The group script is this:
Whenever I move from one rectangle to the other the rectangle that changes color flickers a nanosecond....
there´s no script in the rectangles. Just this one in the group
I guess when I move from one rectangle to the other the group recieves a mouseleave and a new mouseenter message...
Sjat
I made a very simple group with 2 graphic rectangles to check if its my code thats wrong.
The group script is this:
Code: Select all
on mouseenter
set the backgroundcolor of graphic 1 of me to white
end mouseenter
on mouseleave
set the backgroundcolor of graphic 1 of me to black
end mouseleave
there´s no script in the rectangles. Just this one in the group
I guess when I move from one rectangle to the other the group recieves a mouseleave and a new mouseenter message...
Sjat
Re: Stop Group receiving multiple mouseenter
Right.
The group script receives messages from all the controls within it. You options are either to move the handler to the controls themselves, or to limit which controls will be allowed:
if the mouseLoc is within the rect of grc "doNotSend" then...
Now if there are no particular controls that make this work for you, perhaps you can perhaps set up a timer that locks those messages out. Can you do this? (pseudocode):
on mouseEnter
set up timerFlag
if the ticks < timerFlag then exit to top
else pass mouseEnter
end mouseEnter
The "timerFlag" can be, say, 30 or 60 ticks, or whatever, and if another message is generated within that time frame it is ignored.
Craig Newman
The group script receives messages from all the controls within it. You options are either to move the handler to the controls themselves, or to limit which controls will be allowed:
if the mouseLoc is within the rect of grc "doNotSend" then...
Now if there are no particular controls that make this work for you, perhaps you can perhaps set up a timer that locks those messages out. Can you do this? (pseudocode):
on mouseEnter
set up timerFlag
if the ticks < timerFlag then exit to top
else pass mouseEnter
end mouseEnter
The "timerFlag" can be, say, 30 or 60 ticks, or whatever, and if another message is generated within that time frame it is ignored.
Craig Newman
Re: Stop Group receiving multiple mouseenter
thanks Craig
I just remembered something else I´ve asked in the forum to prevent controls receiving messages and that solved my problem...
I just put an empty Mouseenter and mouseleave handler in the graphic control that isn´t affected. And the flicker is gone....
So you where absolutely right in asking about what should happen....This solution won´t work in other scenarios...
thank you for your time
Sjat
I just remembered something else I´ve asked in the forum to prevent controls receiving messages and that solved my problem...
I just put an empty Mouseenter and mouseleave handler in the graphic control that isn´t affected. And the flicker is gone....
So you where absolutely right in asking about what should happen....This solution won´t work in other scenarios...
thank you for your time
Sjat
Re: Stop Group receiving multiple mouseenter
I was of course wrong....blah
I guess I have to choose between a timer (I´m not too fond of that..) or the way I do it: put a rectangle with a blend level at 100 on top of everything...
btw: I´m creating an invisible custom scrollbar where the scrollthumb shows up when you enter the group. Just like the scrollbars in the latest os x.
I guess I have to choose between a timer (I´m not too fond of that..) or the way I do it: put a rectangle with a blend level at 100 on top of everything...
btw: I´m creating an invisible custom scrollbar where the scrollthumb shows up when you enter the group. Just like the scrollbars in the latest os x.
Re: Stop Group receiving multiple mouseenter
It is perfectly OK to solve a problem with a kluge. That overlay is just such a kluge. It heads off messages at the pass.
Sometimes those things fail to adapt to changing conditions, though. A more robust solution, like a timer thingie, is the grown-up way to do it. Think how much fun it would be to write this.
Craig
Sometimes those things fail to adapt to changing conditions, though. A more robust solution, like a timer thingie, is the grown-up way to do it. Think how much fun it would be to write this.
Craig