MathGroup Archive 2008

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

Search the Archive

Re: RE: Nested Grids

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89673] Re: [mg89635] RE: [mg89622] Nested Grids
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Tue, 17 Jun 2008 00:38:56 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

If it were just a matter of coloring, you could flood fill the item using Item[] 
as follows...

Grid[{{Item[Grid[{{a, b}, {c, d}}, Frame -> All], 
    Background -> Orange], e}, {f, g}}, Frame -> All]

And there are a few other things you can do with Item[] as well.  Things inside 
a grid element don't get to control anything outside the margins provided for 
them by the parent grid, but Item[] does let you control some things all the way 
out to and including the divider lines immediately around the item.

But you're right.  There is no way to push those inner Grid dividers of yours 
absolutely all the way to the edge, and the attempts to get you close have 
deleterious effects on the spacing of the other elements in your grid.

Your conclusion that spanning is the best way to do this in completely 
generality is the correct one.

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Mon, 16 Jun 2008 06:37:52 -0400 (EDT), David Park wrote:
> That doesn't quite work because, on my system at least, the nested grid
> still does not quit fill the space, leaving a noticeable gap at the top.
>
> The technique of nested grids sounds nice, but in my view if one wants
> coloring and dividers in the nested part of the grid the Grid command
> still lacks adequate control. It is probably better to use the finest
> grid division and fill in the parts programmatically (or by hand) using
> Spanning.
>
>
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark
>
>
> From: Bob Hanlon [mailto:hanlonr at cox.net]
>
> This solution is not general but works for your example.
>
> Grid[{
> {Grid[{{a, b}, {c, d}},
> Frame -> All,
> Background -> Orange], e},
> {f, g}},
> Frame -> All,
> Spacings -> {0, 0},
> ItemSize -> All]
>
>
> Bob Hanlon
>
> ---- David Park <djmpark at comcast.net> wrote:
>> Nested Grids would seem to be a very useful construct because
>> subportions of
>> a large grid could be independently developed. However, I have been
>> studying
>> the tutorial/GridsRowsAndColumns and it has only one example and that
>> example hides a defect. Here is the slightly modified example with
> Frames
>> added for all elements:
>>
>> Grid[{{Grid[{{a, b}, {c, d}}, Frame -> All, Background -> Orange],
>> e}, {f, g}},
>> Frame -> All]
>>
>> The problem is that the nested Grid does not fill its space. If we use
>> Dividers -> Central, they also do not fill to the edges of the
>> containing
>> item. It seems that we need something like an ImageMargins option, but
>> that
>> is not available. Is there an easy method to get nested grids to fill
>> their
>> space in the enclosing grid? Is there a hard way?
>>
>> --
>> David Park
>> djmpark at comcast.net
>> http://home.comcast.net/~djmpark/





  • Prev by Date: Re: minor progress with 6.0 Documentation
  • Next by Date: Re: 6.0.3
  • Previous by thread: Re: Nested Grids
  • Next by thread: Mathematica Tutorials Format