Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pharo Smalltalk customizing font sizes, styles and backgrounds

Basically I am having 2 problems, I am trying to code a simple GUI using Pharo 4.0 Smalltalk. I am not able to change font size/style in pharo for my labels or text areas/button. I am also not able to change their background colors and border widths. I have tried all ways:

font1 := (TextFontReference toFont: 
                (StrikeFont familyName: 'Atlanta' size: 22)).
TextMorph  new contents: ('test' asText addAttribute: font1); 
color: Color blue; 
autoFit: true; 
borderColor: Color green; 
borderWidth: 2.

SimpleButtonMorph new target: self;
label: 'test1';
actionSelector: #test1click; 
basicBorderColor: Color green; 
basicBorderWidth: 2; 
highlightColor: Color green.

TextMorph  new contents: 'test2'; 
color: Color blue; 
autoFit: true; 
borderColor: Color green; 
borderWidth: 2; 
font:'Atlanta' / fontName: 'Atlanta' pointSize: 22 / fontName: 'Arial' size: 32.

None of the above options work. basically I need to customize my fonts and backgrounds for buttons and labels. How should I go about this?

like image 704
ruhi mehta Avatar asked Dec 10 '25 17:12

ruhi mehta


1 Answers

As for the background colors and border widths it works fine is you add openInWorld .

SimpleButtonMorph new target: self;
label: 'test1';
actionSelector: #test1click; 
basicBorderColor: Color green; 
basicBorderWidth: 2; 
highlightColor: Color green;
openInWorld 

enter image description here

like image 95
z-- Avatar answered Dec 13 '25 04:12

z--



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!