Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Need for a grid morph
Last updated at 1:13 am UTC on 30 December 2007
Question Ramiro Diaz Trepa January 26, 2004:
Regarding the laying out of Morphs, I've seen that in the TableLayout it is not possible to "fix" a specific number of rows and columns. When you resize the main container window, components scroll up or down like if they were words on a word processor. Besides that, I also could not find a way to tell the layout manager that a specific component might occupy, for instance 3 cells horizontally and 1 vertically. I am sure that these things are resolved in some way in Squeak, if anybody could point me a complex window layout example to learn from it would be great.

Answer Ned Konz [To "fix" a specific number of rows and columns] add more interior morphs. For a forced 2 column display, you can do this:
	MyMorph (table, left-to-right, no wrap)
		column1 (table, top-to-bottom, no wrap)
			other morphs
		column2 (table, top-to-bottom, no wrap)
			other morphs
Andreas made a very nice Active Essay about the layouts. It's on SqueakMap. [See also DecentReviewerNotePad.]

Ramiro Diaz Trepat: Thank you very much for your prompt response Ned. I did think of the layout solution you told me, but as a work around to the problem, because doing it that way I believe you cannot control for instance "row alignment" since the height of the rows is independent between columns. That is if I have labels on the left column and text entry fields on the right column, and I want the labels to be vertically centered with their corresponding entry field on the right side of the row. This would be harder to achieve if the components were of variable heights. If this is so, I think that there is a real need for another TableLayout with the usual characteristics, like the ones in Java or C++ (may be I could develop it :)

Ned Konz: So you could do this:
	MyMorph (TableLayout, topToBottom)
		row1 (ProportionalLayout or no layout)
			label
			entry field
		row2 (ProportionalLayout or no layout)
			label
			entry field
Or you could use leftToRight TableLayouts. Just experiment with the 'layout' menu.

Ramiro Diaz Trepat: This produces the same problem but the other way. If you decide to make rows you cannot align columns, if you decide to make columns you cannot align rows. I have come to the conclusion that something like Java's GridBagLayout is really needed in Squeak. I hope I can find the time to code one myself and send it to the list.