Real Software Forums
http://forums.realsoftware.com/

Button sizes/Text size
http://forums.realsoftware.com/viewtopic.php?f=8&t=21802
Page 1 of 1

Author:  jefftullin [ Sun Apr 13, 2008 2:15 pm ]
Post subject:  Button sizes/Text size

On Linux, all the buttons that work fine on Mac and Windows (text size 0) are too small to hold the text under Linux (Ubuntu 7)

If I change the text and button size to suit one platform, it wlooks ridiculous on other platforms.
Is there a standard size of button and text under Linux (seems to default to much larger than I like...)

What does anyone else do to resolve resolution and font size issues like this?

Author:  Bob Coleman [ Mon Apr 14, 2008 4:30 pm ]
Post subject:  Re: Button sizes/Text size

I just put this in the form open event:
#If TargetLinux
ButtonName.TextFont = "FreeSans"
ButtonName.TextSize = 10
#EndIf


That is how I deal with font irregularities.

Author:  hairy_palms [ Tue Apr 15, 2008 6:28 am ]
Post subject:  Re: Button sizes/Text size

weird, i find linux in the middle, windows has the smallest font size, mac the largest, so i have the same problem with the Mac versions of my apps.

Author:  face [ Wed Apr 15, 2009 7:08 pm ]
Post subject:  Re: Button sizes/Text size

any other workaround to 'fix' that strange text behaviour on linux ?
i've so many buttons, editfield, statictext ... and so on ...

Author:  jraess [ Mon Apr 27, 2009 4:02 am ]
Post subject:  Re: Button sizes/Text size

that's where subclassed controls come in handy... whenever we do a multi-platform-project, we never just use the built-in controls.

an example:
1. new project
2. add class 'MyPushButton', set super to: PushButton
3. edit 'MyPushButton':
- AddEventDefinition 'OnOpen'
- edit the Open-Event-handler:
#if TargetWin32 then
me.Height = 20
#endif
#if TargetLinux then
me.Height = 30
#endif
#if TargetMacOS then
me.Height = 24
#endif
OnOpen

4. Add 'MyPushButton' to your window (you find it in 'ProjectControls', not in 'BuiltIn-Controls')

Now all 'MyPushButtons' will auto-magically have the height you desire.
anything you want on the 'Open-Event', you place in you 'OnOpen'-Event-handler

If you want to change the look&feel, all you need to edit is the Class 'MyPushButton' - and all your 'MyPushButtons' will be fine.

This example only shows the how to set a custom 'Height'. You would of course add/change fonts and what-ever behavior you want/need...
another nice thing: if somewhen a behavior of a control should be broken in RB - or if you want to add something to all your 'MyPushButtons' (e.g.: mouse-cursor), you can "easily" work around it in your own class...

Quote:
any other workaround to 'fix' that strange text behaviour on linux ?
i've so many buttons, editfield, statictext ... and so on ...

If you decide to write your own 'MyPushButton': with a bit of luck, it might work to change your existing Buttons quite fast with a "Search All & Replace"...

Author:  reets [ Tue Jul 10, 2012 1:29 pm ]
Post subject:  Re: Button sizes/Text size

Hate to "reopen" this thread but it fits exactly what I'm wondering about. Is this still the preferred, although bad, way of adjusting for OS difference in font size? I have no problem manually adjusting the font size for each control to a set size that works for an OS but I also realize this isn't a good method since some people could be using smaller or larger fonts for vision issue reasons.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/