I am trying to take a user's input, which will determine as list of results. I would like to show that list to the user, one result at a time. Something like the following (which is broken):
Panel[Column[{
Row[{"How many squares? ", InputField[Dynamic[x], Number]}],
(*m=1 so that no out of range error for x < m:*)
Row[{ButtonBox["Squares!", Evaluator -> Automatic,
ButtonFunction -> (m = 1; (r = Map[#^2 &, Range[x]]) &),
Appearance -> "DialogBox"] // DisplayForm}],
Row[{SetterBar[Dynamic[m], Dynamic[Length[r]]]}],
Row[{r[[m]]}]
}]]
It seems that the trouble I am running into is setter bar not taking a dynamic range. I also tried using previous and next buttons which would increment or decrement x modulo m, but Mod[m,x] wasn't happy with a dynamic argument either. Any help would be greatly appreciated.
Length[r]
will be an integer which will not work as a second argument of aSetterBar
. MoreoverDynamic
head stays there so something likeDynamic @ Range @ Length @ r
will not be recognized as aList
correctly. You have to move thatDynamic
outside theSetterbar
. $\endgroup$