I am attempting to creating a UI dialogue that updates itself as selections are made. The issue is the UI is not updating itself even though the dependent variables are being updated. A very minimal example follows.
v =.;
Panel[
Column@{
Row[{"Pick",
CheckboxBar[Dynamic@v, # -> IntegerName@# & /@ Range[3]]}],
Dynamic[
Refresh[
If[ValueQ[v],
v + 1,
"Pick something"
],
TrackedSymbols :> {v}
]
]}
]
What I am expecting to happen is that once v
is assigned a value that the If
will update to show the calculation. However, v
is updated but the Dynamic
does not update.
In the actual case the user select a value from a PopupMenu
. This value is used to query a database with the resultset being used in the next PopupMenu
. Similar to the above except there are some function calls. The variable v
must initially be clear.
Ideas?
Update
I had some to and fro emails with WRI and I think they are looking into why ValueQ does not re-evaluate in the If
. I have worked out that I can use v = Null;
to start and v =!= Null
in the If
to get things to work as expected.
If[v, v + 1, "Pick something"]
instead of yourIf
statement. It's theValueQ
that is not behaving as you expected. I wonder if the fact thatCheckboxBar
always returns a list is getting in the way. $\endgroup$ValueQ
unless there is another way to test if an integer variable as a value. $\endgroup$IntegerQ
? $\endgroup$