PluggableMultiColumnListMorph
Last updated at 5:28 pm UTC on 5 October 2020
PluggableListMorph subclass: #PluggableMultiColumnListMorph
instanceVariableNames: 'listMorphs'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Pluggable Widgets'
Squeak 5.3
The examples below are derived from a mail on the Squeak ML list 15th Oct 2019.
Example 1
Class names with categories
Paste the code below into a workspace.
- Select the lines "1" up and including to "15
- Choose 'do it'.
- Observe the result.
Repeat the three steps above for other line numbers to learn about the formatting options.
"1" model := {
SystemNavigation default allClasses collect: #name.
SystemNavigation default allClasses collect: #category.
}.
view := PluggableMultiColumnListMorph
on: model
list: #yourself
selected: nil
changeSelected: nil.
view extent: 600@300.
view listFilterSet: 'Hand'.
"15" view openInHand.
"Play around with horizontal alignment."
"18" view listMorphs first cellPositioning: #rightCenter.
"19" view listMorphs second cellPositioning: #center.
"20" view listMorphs do: [:col | col cellPositioning: #leftCenter].
"Play around with margins."
"23" view listMorphs do: [:col | col cellInset: 0].
"24" view listMorphs do: [:col | col cellInset: 3@0].
"25" view listMorphs do: [:col | col cellInset: 5].
"Funny but not useful."
view listMorphs first cellInset: 3. view listMorphs second cellInset: 0.
"Fit all contents."
view listMorphs do: [:col | col
hResizing: #shrinkWrap;
vResizing: #shrinkWrap]. "always set anyway"
view
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
"Enable horizontal scrolling"
view
hResizing: #rigid;
hScrollBarPolicy: #whenNeeded;
width: 100.
"Disable horizontal scrolling"
view hScrollBarPolicy: #never.
"Enable vertical scrolling"
view
vResizing: #rigid;
vScrollBarPolicy: #whenNeeded;
height: 600.
"Disable vertical scrolling"
view vScrollBarPolicy: #never.
An example with 3 columns
model := {
SystemNavigation default allClasses collect: #name.
SystemNavigation default allClasses collect: #category.
SystemNavigation default allClasses collect: [:cls | cls subclasses size]
}.
view := PluggableMultiColumnListMorph
on: model
list: #yourself
selected: nil
changeSelected: nil.
view extent: 800@300.
view listFilterSet: ''.
view openInHand.
A third example
pdic := (PdicDataObject at: #content) at: #pdic.
model := {
pdic keys.
pdic keys collect: [:key | (pdic at: key) at: 'English' ].
pdic keys collect: [:key | (pdic at: key) at: 'Deutsch' ].
pdic keys collect: [:key | (pdic at: key) at: 'French' ].
}.
view := PluggableMultiColumnListMorph
on: model
list: #yourself
selected: nil
changeSelected: nil.
view extent: 200@300.
view listFilterSet: ''.
view openInHand.
"--------------------------------------------------------------------------------------------------------"
"Play around with horizontal alignment."
view listMorphs first cellPositioning: #rightCenter.
view listMorphs second cellPositioning: #center.
view listMorphs do: [:col | col cellPositioning: #leftCenter].
"Play around with margins."
view listMorphs do: [:col | col cellInset: 0].
view listMorphs do: [:col | col cellInset: 3@0].
view listMorphs do: [:col | col cellInset: 2@2].
view listMorphs do: [:col | col cellInset: 5].
"Funny but not useful."
view listMorphs first cellInset: 3. view listMorphs second cellInset: 0.
"Fit all contents."
view listMorphs do: [:col | col
hResizing: #shrinkWrap;
vResizing: #shrinkWrap]. "always set anyway"
view
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
"Enable horizontal scrolling"
view
hResizing: #rigid;
hScrollBarPolicy: #whenNeeded;
width: 280.
"Disable horizontal scrolling"
view hScrollBarPolicy: #never.
"Enable vertical scrolling"
view
vResizing: #rigid;
vScrollBarPolicy: #whenNeeded;
height: 600.
"Disable vertical scrolling"
view vScrollBarPolicy: #never.