fix for badly drawn buttons (was Re: Caveats)

Ned Konz ned at bike-nomad.com
Mon Oct 1 23:41:38 UTC 2001


On Monday 01 October 2001 08:32 pm, Daniel Joyce wrote:

> 	It is not desirable if you use larger fonts. Too many windows assume 12 pt
> as the normal size, and are hardcoded for that.
>
> 	With a 22 pt font ( needed for 1280x1024, so I can read stuff ), the text
> runs outside a lot of buttons, and it looks very unprofessional and
> hackish.
>
> 	I can resize fonts in Gnome, KDE, and Windows, and the buttons resive with
> them.
>
> 	Squeak has too many hardcoded extents, and morphs that aren't smart enough
> to resize properly.
>
> 	If Squeak is ever going to be taken seriously as a environment by
> outsiders, it needs to look professional.
>
> 	Not clipping submorphs is silly. Have you ever seen text appear outside
> the window/widget/button that contains it on Win95/KDE/Gnome? I haven't.

The text isn't appearing outside the button, as far as I can tell.
Adding
        self clipSubmorphs: true
to the end of PluggableButtonMorph>>initialize doesn't help.

What's happening is that the button itself isn't being clipped by the 
AlignmentMorph that it's living inside (in the SystemWindow pane).

The case of the switches in the Browser can be fixed easily by making the 
AlignmentMorph clip its submorphs:

Browser>>buildMorphicSwitches

	| instanceSwitch divider1 divider2 commentSwitch classSwitch row aColor |

	instanceSwitch _ PluggableButtonMorph
		on: self
		getState: #instanceMessagesIndicated
		action: #indicateInstanceMessages.
	instanceSwitch
		label: 'instance';
		askBeforeChanging: true;
		borderWidth: 0.
	commentSwitch _ PluggableButtonMorph
		on: self
		getState: #classCommentIndicated
		action: #plusButtonHit.
	commentSwitch
		label: '?' asText allBold;
		askBeforeChanging: true;
		setBalloonText: 'class comment';
		borderWidth: 0.
	classSwitch _ PluggableButtonMorph
		on: self
		getState: #classMessagesIndicated
		action: #indicateClassMessages.
	classSwitch
		label: 'class';
		askBeforeChanging: true;
		borderWidth: 0.
	divider1 := BorderedSubpaneDividerMorph vertical.
	divider2 := BorderedSubpaneDividerMorph vertical.
	Preferences alternativeWindowLook ifTrue:[
		divider1 extent: 4 at 4; borderWidth: 2; borderRaised; color: Color 
transparent.
		divider2 extent: 4 at 4; borderWidth: 2; borderRaised; color: Color 
transparent.
	].
	row _ AlignmentMorph newRow
		clipSubmorphs: true;	" added by NK"
		hResizing: #spaceFill;
		vResizing: #spaceFill;
		layoutInset: 0;
		borderWidth: 0;
		addMorphBack: instanceSwitch;
		addMorphBack: divider1;
		addMorphBack: commentSwitch;
		addMorphBack: divider2;
		addMorphBack: classSwitch.

	aColor _ Color colorFrom: self defaultBackgroundColor.
	Preferences alternativeWindowLook ifTrue:[aColor _ Color white].
	{instanceSwitch. commentSwitch. classSwitch} do: [:m | 
		m 
			color: aColor;
			onColor: aColor darker offColor: aColor;
			hResizing: #spaceFill;
			vResizing: #spaceFill.
	].

	^ row

I wouldn't be surprised if similar fixes weren't possible for other similar 
problems.

It would be nice if someone chased down all the hard-coded extents and made 
them relative to the appropriate font. Though that would make some UI's 
unusable if you changed fonts (like my ArchiveViewer, with its wordy little 
buttons).

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list