Force keyboard focus and font scaling algorithm

Jason Dufair jase at dufair.org
Sun Aug 18 00:48:07 UTC 2002


Hi all -

I'm building a FadingTTListMorph.  You give it a list of strings (soon 
to handle more robust collections than strings) and you get a list like 
the one attached.  This is simply a morph with a collection of 
TTSampleStringMorphs as submorphs (each getting its font from a 
TTFontReader on a local .ttf file).  The selection highlight is fixed 
with the list scrolling (and rolling over) when up/down keys are 
pressed.  I have 3 questions:

1) Is there some way to force the morph to gain keyboard focus when it 
receives #openInWorld?  I'm having a bit of a time trying to figure out 
how keyboard focus moves.  Currently, I have to ctrl-click on the morph, 
then click elsewhere on it to dismiss the menu to get keyboard focus. 
 I've found no other means at this point.

2) I'm having trouble with font sizing (as is probably obvious).  I 
currently set each item to a constant height and then set the width 
proportionally.  My problem is that I end up with different "font sizes" 
given that some strings have letters with ascenders, descenders, etc. 
 Is there some algorthm I can use to cause each list item to have the 
same "font size" (and to space the morphs evenly)?  I've tried to devise 
one, but I'm somewhat font illiterate.

3) At some point I hope to implement "smooth scrolling."  Currently, I 
delete all submorphs and rebuild them to scroll the items.  Is my 
current architecture going to be an achilles heel at some point if I 
want to implement some sort of smooth scroll instead?

This is my first foray into Morphic and I must say it's fun.  It's much 
less daunting than I thought it would be.  Dragonfly is starting to look 
pretty spiff.  I can't wait to have a working prototype (probably 2-4 
weeks at the current rate).  Thanks, all!

Jason Dufair
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FadingTTList.gif
Type: image/gif
Size: 7640 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020817/c99558dc/FadingTTList.gif


More information about the Squeak-dev mailing list