PluggableListMorph
Last updated at 2:41 pm UTC on 16 January 2006
PluggableListMorph is a widget for displaying lists and selecting items from them. See Pluggable Widgets or Pluggable Morphs Demo
Question From: Chris Becker January 23, 2004
I have a SystemWindow pane with a PluggableListMorph whose selection is never highlighted when I click on a list item.
Each list item understands asString and is properly displayed. The PluggableListMorph is definitely firing my model's getListSelector and setIndexSelector when I click, but its selectedMorph and selection instance variables never get set.
Answer From: Ned Konz
And are you sending an appropriate changed: message with the name of your get index selector? (assuming the PLM is plugged to these two selectors):
myGetIndexSelector
^myIndex
mySetIndexSelector: aNumber
myIndex := aNumber.
self changed: #myGetIndexSelector.
Response From: Chris Becker
Ahh, that's the missing link. I was sending changed: when the list is modified but not when the index is updated.
Question From LuLu January 17, 2004 Should I add an PluggableListMorp to an AlignmentMorph?
If I want to add a list in an AlignmentMorph, then which type of list can be chosen?
I have chosen a pluggableListMorph, but the list seems to do wrong.
buildListPane
| aList r |
aList _ PluggableListMorph new
on: self
list: #nameList
selected: #listIndex
changeSelected: #listIndex:
menu: #listMenu:
keystroke: #listKey:from:.
aList hResizing:#spaceFill.
r _ AlignmentMorph new color: Color lightBlue;
layoutInset: 0;
wrapCentering: #center;
cellPositioning: #leftCenter;
hResizing: #spaceFill;
vResizing: #spaceFill.
r extent:380@200.
r addMorphBack: aList.
self addMorphBack: r.
I want to know whether I chose the wrong type of list or if I wrote the wrong code.
Answer Ned Konz
You may not need the AlignmentMorph. If the AlignmentMorph has no other submorphs, you don't need it. You can try this from a Workspace:
stuff _ #(a b c d e).
aList _ PluggableListMorph on: stuff list: #yourself selected: #size
changeSelected: nil menu: nil keystroke: nil.
aList hResizing:#spaceFill.
r _ AlignmentMorph new color: Color lightBlue; layoutInset: 0;
wrapCentering: #center; cellPositioning: #leftCenter; hResizing:
#spaceFill; vResizing: #spaceFill.
r extent:380@200.
r addMorphBack: aList.
r openInHand.