Connectors-based labels question

Ned Konz ned at bike-nomad.com
Tue Dec 3 21:31:16 UTC 2002


On Monday 02 December 2002 11:33 am, David Faught wrote:

> I have been using Maker buttons on a button bar to create the
> Morphs up to this point, and I can manually make these types and
> create more maker buttons for them.  The problem is that they all
> look the same on the button bar and when they are instantiated, for
> that matter.  Is there a way to create a label for something on the
> button bar, or a way to have a morph carry its attached SmartLabel
> with it when its dropped on a Maker button?

Yes. You'll note that in the Connectors flap there are Maker Buttons 
(though they probably don't look like them) with labels. The logic in 
NCMakerButton for receiving a dropped Morph can generate a label 
(which is the name of the Morph, so name the Morph from the halo 
first). However, it only does this if the buttons are labeled, and 
the only time this happens currently is if they're in a NCPartsBin 
(like in the Connectors flap).

So you could make a subclass of NCMakerButton that answers true to 
isLabeled (or just change isLabeled). And use these buttons instead 
(easiest if you also subclass NCButtonBar and change its 
buttonClass).

> I also have not figured out yet how to update the text of a label,
> '56 kbps' for example, when the bandwidth is changed.

You have to find the labels.
This is cleverly hidden in a method called "labels" <g>.
Then : "aLabel contents" gives you their text; "aLabel string: 
'newString'" changes their contents.

> By the way, I really liked the presentation that was contained in
> the old project-based Connectors, and wish I would have seen it
> earlier than I did in my development process.  Is there some way
> you could carry this forward with the more recent changesets, and
> still keep it separate and deletable?

Yeah, probably, though it's in a .pr project. I suppose I could post 
it separately on SqueakMap.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list