beginners question: Connectors in a window
Ned Konz
ned at squeakland.org
Mon Jun 14 14:40:41 UTC 2004
On Monday 14 June 2004 2:36 am, Daria Spescha wrote:
> Hello!
>
> 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'.
> con _ NCConnectorMorph fromMorph: b toMorph: d.
> c _ SystemWindow new.
> c openInWorld.
> c addMorph: b.
> b position: (c position) + (30 at 30).
> c addMorph: d.
> d position: (c position) + (50 at 50).
> c addMorph: con.
Connectors want to be owned by a PasteUpMorph, because of the way you interact
with them. Try this instead:
b _ NCTextRectangleMorph new setTextAt: 1 to: 'Hello'.
d _ NCTextRectangleMorph new setTextAt: 1 to: 'World'.
con _ NCConnectorMorph fromMorph: b toMorph: d.
c _ SystemWindow new.
c openInWorld.
p _ PasteUpMorph new.
c addMorph: p fullFrame: (LayoutFrame fractions: (0 at 0 corner: 1 at 1)).
p addMorph: b.
b position: (p position) + (30 at 30).
p addMorph: d.
d position: (p position) + (150 at 150).
p addMorph: con.
--
Ned Konz
http://bike-nomad.com/squeak/
More information about the Squeak-dev
mailing list
|