[Q][morphic] Collapsing menus. Was: how to hide submorphs
ned at bike-nomad.com
Tue Apr 30 19:13:43 UTC 2002
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
> 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.
self isCollapsed ifTrue: [ aCanvas fillRectangle: (self position
extent: 20 at 20) color: Color green "or whatever you want to draw for
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
GPG key ID: BEEA7EFE
More information about the Squeak-dev