Author Topic: Problem with spacing my layout  (Read 1794 times)

Pakled

  • Newbie
  • *
  • Posts: 28
    • View Profile
Problem with spacing my layout
« on: September 03, 2008, 02:17:08 PM »
Hello all,
I've recently been building a new layout based on the BPC layout. One thing I'm having a problem with is some mysterious sapcing between two columns that are in the same row. The gap has no apparent source. I've set both columns and all their contained cells to the same width. The contents don't go beyond that width setting either. I was wondering if there is some sort of pre-programmed gap between columns or if anyone else has encountered this before?
Pakled - We look for things...

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5427
    • View Profile
Re: Problem with spacing my layout
« Reply #1 on: September 03, 2008, 02:29:48 PM »
All cells in a column will be as wide as the widest cell in the column (in other words, all cells will "stretch" to fill the column, which must be as wide as the widest cell within it).  If you take a cell within a column, and the cell is naturally narrower than the column itself (the cell is not the widest cell in the column), then you can manually set its width to a smaller value and it will shrink to the specified value, so long as that width accommodates the cell's contents.  However, if you do this you will see the "gap" you are referring to, because the column will remain at the width necessary to display the widest cell in the column.

Same goes for rows and cell height...

Pakled

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Problem with spacing my layout
« Reply #2 on: September 03, 2008, 04:36:31 PM »
I figured that but I made all cells in both columns 300 and the columns themselves at 300. I put different colored background on each so I could see which was which but the gap space doesn't show any color at all. Here are my layout and background files. Is there any way you could take a look at them and see what I'm doing wrong?
« Last Edit: September 03, 2008, 04:39:12 PM by Pakled »
Pakled - We look for things...

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5427
    • View Profile
Re: Problem with spacing my layout
« Reply #3 on: September 08, 2008, 12:03:27 PM »
I believe what you are seeing is the "stretching" of the layout to fill the screen.  The rows, columns, and cells are laid out inside of a table, and the table is configured to stretch horizontally and vertically to the size of the screen.  So, regardless of the height and width settings of any particular layout component, the entire layout is still going to stretch to to fill the available space.  Imagine that you simply have two cells in your layout, arranged inside of a row.  If your screen is 1000 pixels wide, and you set the one cell to be 200 pixels wide, the other will automatically stretch to a width of 800 pixels to compensate.  If you were to then set the other cell to be 200 pixels wide as well, what's going to happen?  Technically, this is left to the host program, Internet Explorer, to determine, but I think what you'll probably see is that IE will decide that since both have the same width setting, they should be rendered equally wide - which would end up being 500 pixels each (to fill the width of the screen).  Just a guess, but regardless you won't see cells of 200 pixels wide each next to each other.  You might see 2 cells of 200 pixels wide each, but at best they'll be centered inside of 2 500 pixel-wide spaces.

Where this breaks down is that the width setting actually applies to a container of the cell (or row or column) that you don't actually see.  So, while you may set a cell to have a width of 200 pixels (and the cell contents may allow this, being less than 200 pixels), the part of the table in which the cell resides will still stretch to fill the width of the screen.  So you'll see a cell that is only 200 pixels wide, but it will no longer abut right up to the cells to its immediate left or right.

In the next version of the software, I'm working on changing the layout and I'm thinking of adding a mode in which the layout does NOT attempt to expand to fill the screen.  This would hopefully allow more exact positioning and sizing of layout components.  At this time I have no idea how this will eventually play out. It is a work in progress and we'll just have to see what it ultimately becomes.  This has to be a new mode, because I cannot break existing layouts.

I think you have the right idea in your layout, though.  Probably the best strategy is to insert "spacer" cells that fill in the remaining space.  So, for example, if your screen width is 1000 pixels, and you have a row with 3 cells that you want to be 200 pixels wide each and lay out right next to each other starting on the left side of the screen, you'll need to fill in the remaining 400 pixels so that row isn't stretched to fill the screen.  Add a spacer cell at the end with a width of 400 pixels.  And probably stay away from setting dimensions on the rows and columns themselves, as that usually doesn't have the intended effect.

Hope that helps a little.