[Q][morphic] Collapsing menus. Was: how to hide submorphs

Martin Drautzburg martin.drautzburg at web.de
Tue Apr 30 19:08:24 UTC 2002


Ned Konz <ned at bike-nomad.com> writes:

> If you turn on clipping in the parent, the submorphs outside the 
> parent bounds shouldn't be a problem (because they won't be visible).
> 
> Also if the parent overrides containsPoint: to return false when the 
> point is outside its bounds, you won't be able to interact with the 
> submorphs.

Aaron J Reichow <reic0024 at d.umn.edu> writes:

> Send it #hide and #lock.  That'll make it disappear and no longer recieve
> events.

I tried the code below, but #clipSubmorphs: true still lets me drag
the owner morph from the invisible rectangle below. If I adjust
fullBounds to bounds I can no longer grab, but I have trouble getting
the hidden morph repainted after an #expand. Sending a self changed
from an inspector does repaint it but the same message in the #expand
method seems to have no effect.

I may be completely on the wrong track ... how would *you* collapse a
menu ? 



'From Squeak3.2gamma of 15 January 2002 [latest update: #4843] on 30 April 2002 at 8:58:35 pm'!
RectangleMorph subclass: #Collapser
	instanceVariableNames: 'child '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'dtz-tries'!

!Collapser methodsFor: 'as yet unclassified' stamp: 'dtz 4/30/2002 20:56'!
collapse
	self clipSubmorphs: true.
	fullBounds _ bounds
	! !

!Collapser methodsFor: 'as yet unclassified' stamp: 'dtz 4/30/2002 20:58'!
expand
	self clipSubmorphs: false.
	self layoutChanged.
	self changed.
	! !

!Collapser methodsFor: 'as yet unclassified' stamp: 'dtz 4/30/2002 20:55'!
grabableCollapse
	self clipSubmorphs: true.
	child lock; hide.
	! !

!Collapser methodsFor: 'as yet unclassified' stamp: 'dtz 4/30/2002 20:57'!
grabableExpand
	self clipSubmorphs: false.
	! !

!Collapser methodsFor: 'as yet unclassified' stamp: 'dtz 4/30/2002 20:49'!
initialize
	super initialize.
	self top: 50; clipSubmorphs: false.
	child _ RectangleMorph new top:100.

	self addMorph: child.
	! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

Collapser class
	instanceVariableNames: ''!

!Collapser class methodsFor: 'as yet unclassified' stamp: 'dtz 4/30/2002 20:45'!
open
	self new initialize openInWorld.! !



More information about the Squeak-dev mailing list