Tip: Fix Linux Button Sizes
« Previous Entry | Home | Next Entry »
Written by Thom McGrath on Saturday, February 21, 2009 at 2:22 AM (-05:00)
Categories: REALbasic (20), Tutorials (7)
Tags: GUI (1), Linux (1), PushButton (1), REALbasic (14)
This really bugs me about Linux, at least on Ubuntu. Button sizes are typically 30 pixels tall, as opposed to the 20 pixels on Mac and Windows. So when you're creating your UI and plan to deploy to Linux as well, be aware of this. If your button sizes are 20 pixels tall - the REALbasic default - your buttons will look terrible on Linux, only showing the top half of the caption.
My solution? A subclass of PushButton I call RespectfulPushButton. In it's Open event, I simply make the height 10 pixels taller and move it up by 5 pixels. The result won't harm the UI much, and the buttons look perfect on Linux. You'll then want to define a new Open event, and trigger it from the Open event of the subclass. Of course, use conditional compiles to only resize the buttons on Linux. I then just use this subclass instead. Minimal work to setup, but you'll then need to get into the habit of using the subclass instead when placing new buttons.
PopupMenus have this pain as well. I have not seen this on any other controls, but I most write my own anyway.
License: Creative Commons (details) | Digg | E-Mail Thom McGrath
View More Entries From The Same: Day | Month | Year
Comments
Comments are being accepted below.
Pings
This entry is accepting pings.
Disclaimer: I am currently an employee of REAL Software. My comments and opinions are mine alone and do not represent those of my employer. My posts are not official REAL Software communications, and may contain information that is incorrect or misleading.
Leave a comment
We utilize unique methods to ensure your email address stays private while remaining useful.
Depending on the authentication scheme used, some or all of the personal data entered below will be ignored in favor of the data stored with your account.