Message Boards Message Boards

0
|
427 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to reproduce behaviour of Button with Framed, automatically filling Grid cells?

Given the following example, how can I make each Framed object to fill its Grid cell both vertically and horizontally? Obviously, Grid calculates some cell sizes, that Button knows of, but not Framed, Pane, Panel, etc. How can I reproduce the behavior of Button with other constructs without relying on explicit numbers?

ClearAll[b, f1, f2];

b = Button[#, Background -> LightGray, ImageSize -> Full] &;
f1 = Framed[#, Background -> LightGray, RoundingRadius -> 5] &;
f2 = Framed[#, Background -> LightGray, RoundingRadius -> 5, ImageSize -> Full] &;

Grid[{{b@"321\n123", b@"123456789"}, {b@"321", SpanFromLeft}}, 
   Spacings -> {0, 0}, Frame -> None],
Grid[{{f1@"321\n123", f1@"123456789"}, {f1@"321", SpanFromLeft}}, 
   Spacings -> {0, 0}, Frame -> None],
Grid[{{f2@"321\n123", f2@"123456789"}, {f2@"321", SpanFromLeft}}, 
   Spacings -> {0, 0}, Frame -> None]

enter image description here

POSTED BY: Istvan Zachar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract