Make morph stay in front
Ned Konz
ned at squeakland.org
Thu Nov 4 18:20:41 UTC 2004
On Thursday 04 November 2004 9:43 am, Trygve Reenskaug wrote:
> I have a subclass of PasteUpMorph called DialogMorph.
> The only thing special about it is this method:
> morphicLayerNumber
> " Should make dialog stay in front (most of the time), but DOESN'T
> " ^3
>
> But it doesn't stay in front. I can clock any window and it pops in front
> of myDialog.
>
> Anybody have any ideas?
Yes.
Pretty much the only time that morphicLayerNumber actually does anything is
when you call addMorphInLayer:
openInWorld: aWorld
aWorld addMorphInLayer: self.
aWorld startSteppingSubmorphsOf: self
However, grabbing morphs with the hand and changing between SystemWindows (who
maintain their topmost order) don't respect this.
What I recommend for a morph that really wants to maintain its layer order is
to do it in a step method:
step
owner ifNil: [ ^self stopStepping ].
owner addMorphInLayer: self
or if you *really* want to stay in front of *everything except the hand*:
step
owner ifNil: [ ^self stopStepping ].
owner addMorph: self behind: owner activeHand
--
Ned Konz
http://bike-nomad.com/squeak/
More information about the Squeak-dev
mailing list
|