# Button height problem

**URL:** <https://www.ruby-forum.com/t/button-height-problem/184722>\
**Category:** wxRuby\
**Created:** [March 7, 2010, 12:39pm UTC](https://www.ruby-forum.com/t/button-height-problem/184722 "2010-03-07T12:39:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeNigris\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cab0a1/32.png) [@DeNigris\_S](https://www.ruby-forum.com/u/DeNigris_S)\
**Post date:** [March 7, 2010, 12:39pm UTC](https://www.ruby-forum.com/t/button-height-problem/184722/1 "2010-03-07T12:39:57Z")

</div>

Hi list,

I just started with wxruby and I ran into something - not sure if it’s a  
bug.

No matter what I set the buttons properties/options to, the height of  
the button doesn’t change. Even when I set the text size to 24 pt. and  
it doesn’t fit in the button any more, the button stayed the same height  
and the text runs off the top and bottom.

Thanks!

Sean DeNigris

---

<div class="post-metadata">

**Author:** ![DeNigris\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cab0a1/32.png) [@DeNigris\_S](https://www.ruby-forum.com/u/DeNigris_S)\
**Post date:** [March 8, 2010, 2:56pm UTC](https://www.ruby-forum.com/t/button-height-problem/184722/2 "2010-03-08T14:56:47Z")

</div>

Hi Sean

DeNigris S. wrote:

> I just started with wxruby and I ran into something - not sure if it’s a bug.
> 
> No matter what I set the buttons properties/options to, the height of the button doesn’t change. Even when I set the text size to 24 pt. and it doesn’t fit in the button any more, the button stayed the same height and the text runs off the top and bottom.

It’s not a bug, it’s a feature 😉 Compared to other cross-platform  
toolkits, Wx puts the utmost importance on having the application look  
and act exactly as would an app coded with each platform’s native  
frameworks.

Following this, a text button has an appearance, font face& size and  
colours determined by the platform’s UI standards and possibly the  
user’s own theme settings. Wx enforces this, and you deal with the  
resulting variations in size by using flexible Sizer-based layouts.

So I’d reconsider first why you want to use a different size of button  
since this will break UI guidelines from Windows, Apple and GNOME. Of  
course, there could well be a good reason, and if so, you could look at  
using Wx::BitmapButton (possibly drawing your own Bitmap with text go  
into it), or buttons within a Wx::ToolBar, or using Wx::NativeRenderer  
which will allow you to draw stock GUI items like button edges in native  
style at arbitrary sizes

alex

---

<div class="post-metadata">

**Author:** ![DeNigris\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cab0a1/32.png) [@DeNigris\_S](https://www.ruby-forum.com/u/DeNigris_S)\
**Post date:** [March 8, 2010, 7:58pm UTC](https://www.ruby-forum.com/t/button-height-problem/184722/3 "2010-03-08T19:58:16Z")

</div>

> It’s not a bug, it’s a feature 😉 Compared to other cross-platform toolkits, Wx puts the utmost importance on having the application look and act exactly as would an app coded with each platform’s native frameworks.  
> Aha!

> So I’d reconsider first why you want to use a different size of button since this will break UI guidelines from Windows, Apple and GNOME. Of course, there could well be a good reason, and if so, you could look at using Wx::BitmapButton (possibly drawing your own Bitmap with text go into it), or buttons within a Wx::ToolBar, or using Wx::NativeRenderer which will allow you to draw stock GUI items like button edges in native style at arbitrary sizes  
> I’ll def look into these - the motivation was to have buttons with  
> really big text for older people using the app.

Thank you - that answer was perfect! And so obvious now. Are these  
things (like which platforms do not honor which options) written down  
somewhere, or do you just learn from experience?

Sean DeNigris  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![DeNigris\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cab0a1/32.png) [@DeNigris\_S](https://www.ruby-forum.com/u/DeNigris_S)\
**Post date:** [March 9, 2010, 1:31am UTC](https://www.ruby-forum.com/t/button-height-problem/184722/4 "2010-03-09T01:31:57Z")

</div>

On 08/03/2010 18:57, DeNigris S. wrote:

> > So I’d reconsider first why you want to use a different size of button since this will break UI guidelines from Windows, Apple and GNOME. Of course, there could well be a good reason, and if so, you could look at using Wx::BitmapButton (possibly drawing your own Bitmap with text go into it), or buttons within a Wx::ToolBar, or using Wx::NativeRenderer which will allow you to draw stock GUI items like button edges in native style at arbitrary sizes
> 
> I’ll def look into these - the motivation was to have buttons with really big text for older people using the app.

To me this is an important reason for Wx’s emphasis on native widgets. A  
user who needs big text will (or should) have set that in their desktop  
settings. Similarly, users with other kinds of, say, visual or mobility  
impairment will have set system preferences for colour schemes, or how  
mouse moves and clicks are interpreted. By using the native application  
frameworks to build the GUI the user’s overall settings will be  
honoured, without any extra effort on your part as a programmer. GUI  
toolkits which employ lower-level calls to draw lines and text on the  
screen, and handle raw input from devices might achieve good integration  
at an aesthetic level (look’n’feel), but still not know how to adapt to  
more specialised needs.

I should note that as of wx 2.8, extra support for assistive  
technologies like was incomplete, and not available in wxRuby - but  
common situations like larger text, high contrast etc should be dealt  
with automatically.

> Are these things (like which platforms do not honor which options) written down somewhere, or do you just learn from experience?

AFAIK there isn’t a single place this is all collated. Where there are  
methods not supported at all on one platform or other, this should be  
noted, and the wxWidgets wiki has a lot of notes on distinctive features  
of different OS’s. Prob more useful is to have a quick look at the UI  
guideline documents from Apple, Microsoft and Gnome. Search for platform

- HIG. They’re different in style but have much good advice and thought  
on what makes usable and attractive applications.

best  
alex
