[Newbies] How to set a Font in a StringMorph?

Fredrik Alink falink at free.fr
Fri Sep 4 22:51:10 UTC 2015


I got a nice way of creating button Morphs somewhere on the Web. However,
for showing the button label it uses the StringMorph. In StringMorph I find
the method “font: aFont”. Could I use that for setting the Font shown on the
button? And what should I use as aFont? Doing “aFont := TextMorph new …..”
is wrong. Are there other ways to get to an alternative of the default font
through the StringMorph?

What I did so far:

*My Class instance:*
	labelMorph := (ButtonElementMorph “new”)
		createLabelMorph: aLabel
		withEmphasis: anEmphasis
		/withFont: aFont./

What I found on the web – *ButtonElementMorph Class instance:*
	(StringMorph contents: aLabel)
		emphasis: anEmphasis;
		/font: aFont./

*StringMorph class instance:*
	emphasis: anEmphasis.
	/font: aFont/ “can I use this and what should I place here?”

Thank you in advance for giving me th right direction to find a solution!


View this message in context: http://forum.world.st/How-to-set-a-Font-in-a-StringMorph-tp4848183.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.

More information about the Beginners mailing list