DropDownListMorph

David N. Smith (IBM) dnsmith at watson.ibm.com
Thu Nov 23 14:39:10 UTC 2000


At 7:55 +0000 11/22/00, Daniel, Sofie and Beatrice wrote:
>more newbie questions ... thanks to all for help ...
>
>if I create and display a new instance of DropDownListMorph and initialise and inspect the items list like this:
>
>d _ DropDownChoiceMorph new.
>d items: (AbstractSound soundNames).
>d openInWorld.
>d inspect
>
>but then click on the list, why does the list go back to being the default of a colour list? How do I stop this?
>
>I appreciate that I should (ideally) be able to sort a lot of these things out by going through the code, but frankly, although I'm OK with Smalltalk, there's just too much of it to be able to untangle it right now ... especially trying to work out how Morphic goes together / can be used. So when something like this comes up, its back to the list.
>
>Thanks again
>
>Daniel

Daniel:

Something I find useful is to look at all users of a class to see how the class is typically used. There is but one user of DropDownChoiceMorph. The protocol is a bit odd, exposing a call to #maxExtent:  to compute the space necessary for the list you give it (but then not computing widths or heights for updated lists obtained by sending getItemsSelector).

Attached is a small update to DropDownChoiceMorph which fixes that problem by automatically calling #maxExtent: internally. It also makes a border be the default. (There is an example in a class method).

It's also not clear why the parent (PopUpChoiceMenu) doesn't compute font widths or heights. It's also a bit odd that PopUpChoiceMenu has colors as default menu items instead of using a nil selector. I can't find any callers that use the default. I suspect that both were done in a hurry and just need some cleanup.

Hope you're having fun with Squeak!

Dave
-------------- next part --------------
Skipped content of type multipart/appledouble-------------- next part --------------
_______________________________
David N. Smith
IBM T J Watson Research Center
Hawthorne, NY
_______________________________
Any opinions or recommendations
herein are those of the author  
and not of his employer.


More information about the Squeak-dev mailing list