简体   繁体   中英

Pharo4 Spec GUI: How to change font size

I am thinking of programming my next project in Pharo. For this I will need to create a status monitor that can be seen from further away. The GUI is very simple. Basically just a few labels and buttons. Here is the problem: I need the font to be rather big - so that it can be seen from further away. How can I achieve this? Here is some sample code. My two labels need their font sitze changed:

initializeWidgets
  last1 := self newLabel.
  last1 label: '88,88'.

  last2 := self newLabel.
  last2 label: '99,99'.

Thanks a lot!!!

Not well supported for now. You can workaround this problem be resetting the font when the widget is built:

|lm|
lm:=LabelModel new.
lm label:'Hello'.
lm whenBuiltDo: [ :w | w widget font: (LogicalFont familyName: 'Source Code Pro' pointSize: 30)].
lm openWithSpec.

When using lm whenBuiltDo: within the initializeWidgets method of a ComposableModel we do not get the LabelModel as in above suggestion, but a MorphicLabelAdapter. That one does understand widget again and returns the LabelModel. So above example needs to read:

... lm whenBuiltDo: [ :w | w widget widget font: (LogicalFont familyName: 'Source Code Pro' pointSize: 30)]. lm openWithSpec.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM