Does anyone have a recommendation for setting the default font for all controls depending on the platform? I am running into serious appearance issues on some Windows system and most Linux systems if I just use “System” and change the font size - especially with ListBoxes and Combo Boxes.
Or, is there a way for us to define what the app uses for the “System” font so that “System” is the font that we want used?
That defeats the purpose of System. Assign a dynamic constant for the font, and define your font by platform with the constant. I have tested and this works as expected on Mac and Windows. This works just like the Menu Shortcuts by platform.
While Tim Parnell’s method works for defining the font as the constant, it appears that the value for the constant is ignored. I set the constant to point to “Courier” (which is verified and on the test system and shows up in Xojo’s font pick lists). but the font in the app is still some form of Sans Serif font (I’m assuming the normal font for System) instead of the expected monospaced mess.
The constant setting is saved and shows in both the IDE property and the text source. and using the same font (Courier 10 Pitch) from the font picker sets the controls’ font properly.
I was on Linux and - like I mentioned - that’s same name that shows in Xojo’s Font Picker. I’m not trying to use Courier, I was trying to verify that the constant was not being set since “FreeSans” *what I do want to use) and the System font are very close in appearance.
As an alternative, subclass your controls and have them set the font you want from a constant in the Open event. Use the subclasses in your windows. The additional advantage is that you can later define all sorts of behavior across the app easily. For example, my pushbuttons will grow by about 5 pixels or so on platforms that are not the Mac and my Listboxes will all use the same row highlighting technique, easily changed later if I decide on something better or just different.
I started there, but I was trying to not have to edit over 1,300 controls :). And, we all know how fidgety the IDE becomes when you’re working with that large of a collection of items.
Just to provide a bit of info for the record, here’s my constant definition:
#tag Constant, Name = kSystemFont, Type = String, Dynamic = False, Default = \"", Scope = Public
#Tag Instance, Platform = Mac OS, Language = Default, Definition = \"Arial"
#Tag Instance, Platform = Linux, Language = Default, Definition = \"FreeSans"
#Tag Instance, Platform = Windows, Language = Default, Definition = \"Helvetica"
#tag EndConstant
The interesting thing is that this doesn’t work on any of the platforms, so since Tim P is using such a mechanism, it must have worked properly in previous Xojo versions. Tim, could you verify that your constant mechanism actually works under 19r1.1?