MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

ButtonFunction for grid of custom Buttons

Module[{graphics, buttons, labels, myAction},
myAction[x_] :=
Print["Label: ", x];
labels = FromCharacterCode /@
((ToCharacterCode["A"][[1]] - 1) + Range[10]);
graphics = Graphics[{#, Disk[{0, 0}, 0.1]}] & /@ 
"ColorList"], Length[labels]];
buttons = 
myAction[#] &, Appearance -> None] & /@ 
GraphicsGrid[Join[Partition[Riffle[labels, buttons], {8}]],
Frame -> None, 
ImageSize -> 225, Dividers -> {{True, {False,
True}}, All}]

I am trying to use custom Buttons to highlight different parts of a
graphic. I want the ButtonFunction for each button to do something
with the label associated with the button, but I can't figure out how
to do this. The output that I get from the sample if I click "D" above


rather than "Label: D" as I want.

Any suggestions would be appreciated.

  • Prev by Date: new Graph function + combinatorica: various problems
  • Next by Date: Re: MathKernel -script in MacOSX
  • Previous by thread: Re: new Graph function + combinatorica: various problems
  • Next by thread: strange behavior with Map