I'm in-setting a grid of buttons over an image, and I think it's probably a very simple thing that I'm missing. In the example below Scaled
doesn't work to stretch the Button
's properly:
Graphics[{Inset[ExampleData[{"TestImage", "Lena"}], Scaled[{0, 1}],
Scaled[{0, 1}], Scaled[1]],
Inset[Button["test", Print[1], Background -> RGBColor[1, 0, 0, 0.3],
ImageSize -> Automatic], Scaled[{0, 1}], Scaled[{0, 1}],
Scaled[{1, 1/2}]],
Inset[Button["test", Print[1], Background -> RGBColor[0, 1, 0.3],
ImageSize -> Automatic], Scaled[{0, 1/2}], Scaled[{0, 1/2}],
Scaled[{1, 1/2}]]
}, PlotRange -> {{0, 1}, {0, 1}}]
It should look like this:
The above I made with this:
Overlay[{ExampleData[{"TestImage", "Lena"}],
TextGrid[{{Button["test", Print[1],
Background -> RGBColor[1, 0, 0, 0.3],
ImageSize -> {512, 256}]}, {Button["test", Print[2],
Background -> RGBColor[0, 1, 0, 0.3],
ImageSize -> {512, 256}]}}, Spacings -> {0, 0}]}]
Which would be a solution except that:
- I don't want to give explicit
ImageSize
s Overlay
kills the buttons