First:
According to the documentation Dynamic[expr,f]
evaluates f[val,expr]
during interactive changing or editing. Now check this example:
DynamicModule[{y, g},
Column[{
Manipulator[Dynamic[y, (y = #; g = {#1, ##2}) &]],
{"y", {"val", "expr"}},
Dynamic[{y, g}]
}]]
When you move the slider you will find there is a lag between g[[1]] (val)
and g[[2]] (expr)
.
My question is what controls and decides about this lag?
Note:
I am not looking for solution of this (because one can do Dynamic[expr,{f,fend}]
). Just I want to understand how does this behavior happen
Second:
When we have three functions, Dynamic[expr,{fstart,f,fend}]
typically evaluates fstart[val,expr]
once when the mouse is pressed, then evaluates f[val,expr]
whenever the mouse is moved, and then evaluates fend[val,expr]
once when the mouse is released.
Now check this example:
col = None; {Slider[
Dynamic[x, {(col = Blue; x = #) &, (col = Red;
x = #) &, (col = Green) &}], Background -> Dynamic[col]],
Dynamic[x]}
It is clear (as I can see) when mouse is pressed, Blue color Background
does not show up which means the fstart[val,expr]
is not evaluated.
Any explanation for this?