[Q] fullBounds and Bounds in Morphic

Andrew P. Black black at cse.ogi.edu
Wed Dec 29 21:24:32 UTC 1999


>
>!AccessorPreferences methodsFor: 'as yet unclassified' stamp: 'RAA 
>12/29/1999 07:18'!
>initialExtent
>
>	^330 at 200! !
>=========
>then you will get more of the behavior you expect.


Ah!  Thank you, thank you!

My new changeset is at

<http://www.cse.ogi.edu/cse504/programs/AccessorCodeGen.st> and I 
have stripped out some of STP's code that wasn't being used.  This 
now seems to work, and I humbly submit it as an useful extension to 
the browser.

I'm still not very happy with my initialExtent method, though.

!AccessorPreferences methodsFor: 'displaying' stamp: 'apb 12/29/1999 11:35'!
initialExtent

	^ 340 @ ((rows min: 12) * 19 + 35)! !

Too many magic numbers!  The rows min: 12 calculation is intended to 
leave room for at most 11 instance variables and the header; more 
than that and the user uses the scrollbar.  But I would like to be 
able to ask the scrollpane what the width of its submorphs are, and 
what the height of the window frame is, rather than putting in 340 
and 35.  I couldn't even get the height of a row by asking it (I got 
40 as the answer); the magic number 19 came from the explorer.

I would have thought that shrinkwrap would do something like what I want.

Oh, and in MVC, it still makes a much too large window.  Despite 
using the same initialExtent ...


>
>>If there is anything written on how bounds and fullBounds interact, I
>>would appreciate a pointer.
>
>I'm not sure what you mean by interact, but the simple difference is this:
>- bounds is the rectangle enclosing a morph
>- fullBounds is generally the rectangle enclosing the morph PLUS all 
>its submorphs. Some morphs (those related to scrolling, e.g.) apply 
>clipping and ignore anything outside their own bounds so they will 
>implement this a bit differently. Hope this is what you were asking.
>

So, if I understand this right, fullBounds is the space that I want 
to occupy on the screen, or more generally in the enclosing morph. My 
fullBounds might be
	(1) the same as my bounds (often)
	(2) bigger than my bounds, if some submorphs extend beyond
             my bounds.
	(3) smaller than bounds (never?)

When I'm asked for my fullBounds, I would normally ask all of my 
submorphs what their fullBounds are, and answer the smallest 
enclosing rectangle.  But if, for example, I'm a vertical scrollPane, 
I might give a smaller (in height) answer, because I can scroll to 
make the cropped morphs visible.

If this is right, it seems that bounds should be private.  I might, 
or might not, use my bounds in calculating my fullBounds, but no 
other object should ask for my bounds.

Please correct me where I'm wrong!

	Andrew





More information about the Squeak-dev mailing list