[BUG][SUGGESTION FOR FIX] MVC Button Label Misalignment
Andrew C. Greenberg
werdna at gate.net
Mon Feb 21 12:52:21 UTC 2000
Button labels in MVC windows have their labels centered as though the
window had no border. If the window does have a border of moderate
thickness, a button appearing near the outside of the window will
have its label misaligned, in some cases invisible.
(The bug is not apparent in the stock browser windows because their
StandardSystemView windows have thin borders and the buttons are not
near the outside of the window. For buttons resting entirely
"inside" the border, the centering is unaffected by the bug)
I have not tested to whether there is an analogous bug in Morphic.
The following code is not really a fix -- it is flawed in that it
introduces a magic number and recomputes the centering each time the
window is displayed, but it may perhaps help to illustrate a solution
to this problem that leaves existing windows unaffected. I leave it
to folks with a better understanding of the code to address the
problem (The computation in centerLabel, via getWindow, appearing
essentially centering the label bounding box in itself, left me
baffled, so I left it alone).
PluggableButtonView>>displayView
"Displays this switch and its label, if any."
self clearInside.
label ifNotNil: [
(label isKindOf: Paragraph) ifTrue: [
label foregroundColor: self foregroundColor
backgroundColor: self backgroundColor].
label
align: (label boundingBox center + (0 at 2))
with: self insetDisplayBox center.
label displayOn: Display
at: label boundingBox topLeft
clippingBox: self insetDisplayBox].
complemented _ false.
More information about the Squeak-dev
mailing list
|