Hi,
Sorry late response but yesterday I was not around.
> On 20 Oct 2015, at 18:42, stepharo <stepharo@free.fr> wrote:
>
> for the mooc videos I must use larger fonts.
> So I ended up hacking and changing the hardcoded number in default
>
> defaultRowHeight
>�� �� ^ 24
>
> rowHeight
>�� �� "This is the row height your rows will have. Cells answered in dataSource will be forced to have
>�� �� ��this height number... We force it instead allowing lists to have any height because the logic to
>�� �� ��calculate rows becomes complicated. Possible, but complicated :)"
>
>�� �� ^ rowHeight ifNil: [ self class defaultRowHeight ]
>
>
> Esteban two questions:
>
> - when I read the code of FTmorph I was thinking that a lot of it has not much to do with UI but looks like a model :).
this is not a question :)
in the case of rowHeight, it determines how the row looks (and not what it shows) then is UI (IMO)��� anyway I���m aware this is not 100% MVC but knowing the height of rows is very important to calculate in a fast way how many rows fit and get the rows from datasource (an operation that happens a lot so is convenient to have it as fast as possible (at least in a ���fast table���).
this do not supports variable height but that can be achieved by extending the table without compromising the performance of the parent(just very few use-cases need a variable height table).
>
> - if I were about to manage the height of a row based on its actual contents where should I put it.
as described, you need to extend the functionality, this is not supported in current version (reason already explained).
For me, to support this you need to extend:
- rowHeight should be rowHeightFor: index
- visibleRows and around need to take first visible row height, then iterate one by one asking for the each row size.
- datasource needs to be extended with ���rowHeight: index���
> FTTableContainerMorph is containing what is visible but I wonder why it was asking this to the FastTable and to the elements displayed?
explained above: speed needs.
>
> Why the ContainerMorph does not ask the FTTableRowMorph for its height and it could be computed based on the font.
> I still did not get where the strings built.
I didn���t thought about, that���s why is not calculating font size :)
Also��� I cannot know your table will contain text��� that���s a task for the datasource, then (to answer appropriate row height)��� but it needs to be fast! :)
Esteban
>
>
> may be here
>
> updateExposedRows
>
>�� �� ...
>
>�� �� | cell |
>�� �� �� �� �� �� cell := (self owner dataSource
>�� �� �� �� �� �� �� �� cellColumn: (columns at: columnIndex)
>�� �� �� �� �� �� �� �� row: rowIndex).
>�� �� �� �� �� �� cell width: (columnWidths at: columnIndex).
>
> We should add more comments to methods.
>
>
> Stef
>
>
>
> drawOn: canvas
>�� �� | x y cellWidth cellHeight rowsToDisplay rowSubviews highligtedRowIndexes primarySelectionIndex |
>
>�� �� self bounds ifNil: [ ^ self ]. "Nothing to show yet"
>�� �� self owner ifNil: [ ^ self ].
>
>�� �� x := self left + self class rowLeftMargin.
>�� �� y := self top.
>�� �� cellWidth := self width - self class rowLeftMargin.
>�� �� cellHeight := self owner rowHeight.
>�� �� �� �� �� �� �� �� �� �� ^^^^^^^^^^^^^^^^^^^^^^^
>
>�� �� highligtedRowIndexes :=
>�� �� �� �� self owner selectedRowIndexes,
>�� �� �� �� self owner highlightedRowIndexes.
>�� �� primarySelectionIndex := self owner selectedRowIndex.
>
>�� �� "For some superweird reason, calling #calculateExposedRows here instead in #changed (where
>�� �� ��it should be called) is 10x faster. Since the whole purpose of this component is speed, for
>�� �� ��now I'm calling it here and adding the #setNeedRecalculateRows mechanism.
>�� �� ��History, please forgive me."
>�� �� self updateAllRows.
>
>�� �� rowsToDisplay := self exposedRows.
>�� �� rowSubviews := OrderedCollection new: rowsToDisplay size + 1.
>�� �� headerRow ifNotNil: [
>�� �� �� �� headerRow bounds: (x@y extent: cellWidth@cellHeight).
>�� �� �� �� y := y + cellHeight + self owner intercellSpacing.
>�� �� �� �� rowSubviews add: headerRow ].
>
>�� �� rowsToDisplay keysAndValuesDo: [ :rowIndex :row | | visibleHeight |
>�� �� �� �� visibleHeight := cellHeight min: (self bottom - y).
>�� �� �� �� row bounds: (x@y extent: cellWidth@visibleHeight).
>�� �� �� �� y := y + visibleHeight + self owner intercellSpacing.
>�� �� �� �� rowSubviews add: ((highligtedRowIndexes includes: rowIndex)
>�� �� �� �� �� �� ifTrue: [
>�� �� �� �� �� �� �� �� "IMPORTANT: I need to set owner to nil because otherwise it will trigger an
>�� �� �� �� �� �� �� �� ��invalidation of the owner when adding morph to selectionMorph, causing an
>�� �� �� �� �� �� �� �� ��infinite loop"
>�� �� �� �� �� �� �� �� self
>�� �� �� �� �� �� �� �� �� �� toSelectionRow: (row privateOwner: nil)
>�� �� �� �� �� �� �� �� �� �� primary: primarySelectionIndex = rowIndex ]
>�� �� �� �� �� �� ifFalse: [ row ]) ].
>
>�� �� submorphs := rowSubviews asArray.
>�� �� super drawOn: canvas.
>�� �� needsRefreshExposedRows := false
>