[Newbies] usage of PluggableListMorph

Herbert König herbertkoenig at gmx.net
Wed Jun 6 08:28:32 UTC 2007


Hello Konrad,


KK> I’ve got troubles using PluggableListMorph. Ijust need a
KK> ListBox to put some strings into it.

id you google for PluggableMorphsDemo.pr you'll have a demo project
which I tried with 3.6 to 3.8.

I can mail it to you on request.

Here some code I'm currently working on (open with a FileList):
...buildList.st builds the list.

on: sets the target which is the model and has to implement the other
methods listed here. (i usually do it in protocol plugging)

list: just gets a collection whose element populate the list. These
need not be strings.

selected: is a method which returns the current index on the list.
It's an accessor on an Integer, 0 means no selection.

changeSelected: is the method which at least sets the new index but I
also implement the behaviour which the list shows when I click on an
element.  This is in ...workUnitSelection.st. The changed at the end
is crucial to tell the PluggableListMorph via the dependency mechanism
to highlight the newly selected item.

beware, listFont is a method of mine which returns a font.

..insertNew.st shows how i add a new element to the list.
daysWork is the model, add: adds the newly created workunit.
the important things are the two changed: notifications.

The first tells the PluggableListMorph that the list has changed
(grown) the second that i fiddled with the index of the list.

KK> irst problem happens when I open a PListMorph inworld - can’t drag it.

use the halo (red), maybe resist being picked up is active.

Or maybe you can't drag it inside the list, this is natural behaviour
of the list.

KK> Secondly I have no idea how to put my choice items intothe
KK> PListMorph. I tried list: but it doesn’t work.

see above, maybe you have to read up on the dependency mechanism.

KK> It would also be very interesting to me if someone knewa
KK> method, which returns a collection of all subclass instances of a
KK> certainclass.

allSubInstances :-)) really.

Cheers,

Herbert                            mailto:herbertkoenig at gmx.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DayfileUI-buildList.st
Type: application/octet-stream
Size: 472 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070606/d2efa477/DayfileUI-buildList.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DayfileUI-workUnitSelection.st
Type: application/octet-stream
Size: 321 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070606/d2efa477/DayfileUI-workUnitSelection.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DayfileUI-insertNew.st
Type: application/octet-stream
Size: 592 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070606/d2efa477/DayfileUI-insertNew.obj


More information about the Beginners mailing list