[Newbies] Re[3]: [UI] chang tab font in a flap ?

Herbert König herbertkoenig at gmx.net
Sat Nov 10 15:16:20 UTC 2007


Hello Tony,

HK> Trying to help you how to fish, cause in the time I have I didn't
HK> manage to do it myself.
HK> I'll try later to make it work and report here.
I'll write up my findings as I go along: (in the end there is a
solution but I think most important is you see methods to find out
something.)

Browsing IconicButton (which is what the Flaps contain) it seems to me
that the label is not a Text or a TextMorph so it doesn't have a font
you can change.

I guess from looking at the code that an Iconic button uses a
StringMorph to get the Form of its label and then adds that graphic to
its own graphic.

So the task seems twofold:
1- Find out which font is used for building the labels of the icons in
the flaps
2- Find out how to rebuild the flaps.

The second task was easier. I used the method finder to look for
methods with "flaps" in their name.

addStandardFlaps looked promising but the comment to the method said
that the method itself does not display the flaps. But browsing for
senders of addStandardFlaps revealed the class side method
reinstateDefaultFlaps of Flaps class.

So Flaps reinstateDefaultFlaps in a Workspace removes all flaps and
rebuilds them. Give it some time when you run it the first time.

So next I copied the Preferences class method chooseFlapsFont to a
workspace, changed every self to Preferences and made it set the
button font. This looked like:

Preferences chooseFontWithPrompt: 'Choose a flapsIcons font' translated
andSendTo: Preferences withSelector: #setButtonFontTo:
highlight: Preferences standardButtonFont

But rebuilding the flaps with

Flaps reinstateDefaultFlaps

still gave me the old fonts.

So I think we need to solve a third problem, that's to regenerate the
IconicButtons in the Flaps and maybe step 2 from above isn't needed at
all.

After I followed that false trail for a while I found in IconicButton

initializeWithThumbnail:withLabel:andColor:andSend:to:

and in this method I saw that IconicButton uses standardEtoysFont
which can be set from the world menu as described in earlier mails.

That finally did it. I had an interesting time finding it out.

To sum it up:
In the world menu set the etoys font to what you like in your Flaps.
Then in a Workspace run:
Flaps reinstateDefaultFlaps

Then reset the etoys font to what you like for etoys.

The first time you use the new Flaps you probably have to pull them
out manually to accommodate the wider font.

Cheers

Herbert                            mailto:herbertkoenig at gmx.net




More information about the Beginners mailing list