Button label centering with GTK+2

Julian Smart julian at anthemion.co.uk
Thu May 22 00:39:15 PDT 2008


If I add this to the end of the frame constructor in the minimal sample 
in wxWidgets 2.8 (today's SVN):

    wxFont font(*wxNORMAL_FONT);
    font.SetWeight(wxBOLD);

    wxPanel* panel = new wxPanel(this, wxID_ANY);
    wxButton* button = new wxButton(panel, wxID_OK, wxT("Hello"), 
wxPoint(10, 10), wxSize(200, -1));
    button->SetFont(font);

I get a bold button correctly centred in both orientations (Debian Etch, 
Gnome).

Perhaps you could try the above, and if you still get the off-centre 
label then that could indicate a difference either in GTK+ or in version 
of wxGTK, or maybe related to the version of desktop environment or theme.

I'd suggest simply not using bold. It may make the user think it's the 
default button.

Regards,

Julian

raananb wrote:
> Packages are identified as 
> Thanks.
> Installed packages:
>
> gtk2-engines 1:2.14.1-0ubuntu1
> gtk2-engines-murrine  0.53.1-1ubuntu1
> gtk2-engines-pixbuf 2.12.9-3ubuntu4
>
> apt-get update + apt-get upgrade did not provide a newer library.
>
> Does this provide any useful information?
>
> Where do I go from here?
>
>
> Igor Korot wrote:
>   
>> What GTK version do you use? Is upgrading GTK help?
>>
>> Maybe it's a GTK bug/limitation...
>>
>> Thank you.
>>
>> -----Original Message-----
>>     
>>> From: Vadim Zeitlin <vadim at wxwidgets.org>
>>> Sent: May 21, 2008 5:49 AM
>>> To: wx-users at lists.wxwidgets.org
>>> Subject: Re[2]: Button label centering with GTK+2
>>>
>>> On Tue, 20 May 2008 14:25:41 -0700 (PDT) raananb <raanan at barzel.org>
>>>       
> wrote:
>   
>>> r> Tried different sequences, but no improvement. I did notice that the
>>>       
> problem
>   
>>> r> is present with the larger font even if it is normal (not bold).
>>>
>>> Sorry, you've already tried everything I could think of. I really don't
>>> know why doesn't gtk_button_set_alignment() work and have no other ideas
>>> about how to fix it unfortunately.
>>>
>>> Regards,
>>> VZ
>>>
>>> -- 
>>> TT-Solutions: wxWidgets consultancy and technical support
>>>               http://www.tt-solutions.com/
>>>
>>> _______________________________________________
>>> wx-users mailing list
>>> wx-users at lists.wxwidgets.org
>>> http://lists.wxwidgets.org/mailman/listinfo/wx-users
>>>       
>> _______________________________________________
>> wx-users mailing list
>> wx-users at lists.wxwidgets.org
>> http://lists.wxwidgets.org/mailman/listinfo/wx-users
>>
>>
>>     
>
>   


-- 
Julian Smart, Anthemion Software Ltd.
28/5 Gillespie Crescent, Edinburgh, Midlothian, EH10 4HU
www.anthemion.co.uk | +44 (0)131 229 5306
Tools for writers: www.writerscafe.co.uk
wxWidgets RAD:     www.anthemion.co.uk/dialogblocks



More information about the wx-users mailing list