Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
PluggableListMorph
Last updated at 10:23 am UTC on 3 October 2020
PluggableListMorph is a widget for displaying lists and selecting items from them.
Used for example by PluggableFileList.

Hierarchy browser on PluggableListMorph

PluggableListMorph_hierarchy_Squeak5dot3.png

Category 'Morphic Pluggable Widgets'

PluggableListMorph_as_superclass_2020.png

More

See Pluggable Widgets or Pluggable Morphs Demo

Class comment:

I am a list widget that uses the change/update mechanism to display model data as a vertical arrangement of (maybe formatted) strings and icons in a scroll pane.

When I am in keyboard focus, type in a letter (or several letters quickly) to go to the next item that begins with that letter. If you enabled the "filterable lists" preference, I will hide all items that do not match the filter.

Special keys (arrow up/down, page up/down, home, end) are also supported.

2004

Older material, to review:
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:
| r |
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 openInWorld.