2
Clear["Global`*"];
Table[FlipView[Framed[Style["A", 32, Black, Bold]
     , ImageSize -> {60, 60}, Alignment -> Center, 
     Background -> #] & /@ Lighter@{Red, Green, Blue}, 1], {4}]

enter image description here

Question

As the colors change upon clicking, I would like to get the colors (or indices of the colors) for the four items as a list. How can this be done?

Thanks for your help.

Syed
  • 52,495
  • 4
  • 30
  • 85

1 Answers1

2

FlipView allows the second argument to be Dynamic.

k = Table[1, {4}];
Table[With[{i = i}, 
  FlipView[
   Framed[Style["A", 32, Black, Bold], ImageSize -> {60, 60}, 
      Alignment -> Center, Background -> #] & /@ 
    Lighter@{Red, Green, Blue}, Dynamic[k[[i]]]]], {i, 4}]

Dynamic@k (* {1, 1, 1, 1} *)

Domen
  • 23,608
  • 1
  • 27
  • 45