beginners question: Connectors in a window (corrected version)
ned at squeakland.org
Mon Jun 14 14:44:59 UTC 2004
On Monday 14 June 2004 2:36 am, Daria Spescha wrote:
> I have a problem: I want to have some Morphs in a Window and connect
> them with connectors. I want the connector to be also in the window, but
> with window addMorph: connector (see code below) the connector is
> opened in the world, not in the window and when I close the window, the
> connector remains there. How can I add the connector to the window?
> b _ NCTextRectangleMorph new setTextAt: 1 to: 'Hello'.
> d _ NCTextRectangleMorph new setTextAt: 1 to: 'World'.
Ah, I just noticed that. Since setTextAt:to: returns the *text morph* itself,
you want to add a '; yourself to those phrases.
Trying again (corrected version):
b _ NCTextRectangleMorph new setTextAt: 1 to: 'Hello'; yourself.
d _ NCTextRectangleMorph new setTextAt: 1 to: 'World'; yourself.
con _ NCConnectorMorph fromMorph: b toMorph: d.
c _ SystemWindow new.
p _ PasteUpMorph new.
c addMorph: p fullFrame: (LayoutFrame fractions: (0 at 0 corner: 1 at 1)).
p addMorph: b.
b position: (c position) + (30 at 30).
p addMorph: d.
d position: (c position) + (150 at 150).
p addMorph: con.
Stay tuned for the Connectors 2 release (today)!
More information about the Squeak-dev