Ned Konz ned@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@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.! !
On Tuesday 30 April 2002 12:08 pm, Martin Drautzburg wrote:
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.
Normally, the fullBounds is what is repainted.
I'd recommend not having visible submorphs outside your fullBounds. Actually, I'd recommend not having submorphs at all outside your fullBounds.
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 ?
You can just override drawOn: to only draw the collapsed view when collapsed, otherwise call super drawOn: for drawing the whole thing.
drawOn: aCanvas self isCollapsed ifTrue: [ aCanvas fillRectangle: (self position extent: 20@20) color: Color green "or whatever you want to draw for collapsed" ] ifFalse: [ ^super drawOn: aCanvas ].
You may also want to override fullBounds to be sensitive to your collapsed state (otherwise you'll be asked to redraw when it's not strictly necessary).
squeak-dev@lists.squeakfoundation.org