Let's say we have a Rectangle
with color which depends of CurrentValue["MouseOver"]
:
Deploy@Framed@Graphics[
Dynamic @ {If[CurrentValue["MouseOver"], Red, Green], Rectangle[]}
, ImagePadding -> 10]
- With cursor over the
Rectangle[]
the color switches toRed
as expected, - also if one put the
"MouseDown"
and drag it around it is stillRed
, - however if you put the
"MouseDown"
outside the rectangle, on the padded area, and drag it to the rectangle it will not switch the color till"MouseUp"
.
Is there any way to avoid such behaviour in general?
I can create some workarounds for particular situations but I'm looking for a general solution. I was thinking about EventHandler
's PassEvents
options but it seems it is a deeper problem (I've failed with this approach :)).
It looks like the problem is the "MouseDown"
event is blocking some functions, for example:
Dynamic@CurrentValue["ControlKey"]
is not working while the mouse button is down.- I've faced it before with
MouseAppearance
: Problem MouseAppearance updating while “MouseDown”
Dynamic@CurrentValue["ControlKey"]
and press Ctrl when the Mouse is down. $\endgroup$DynamicWrapper[ Dynamic[t], Refresh[t = AbsoluteTime[], UpdateInterval -> 0.1] ]
, and press the mouse button. $\endgroup$