Re: #10566: wxGTK-2.8.9 wxComboBox::SetFont() does not work

2 views
Skip to first unread message

wxTrac

unread,
Sep 26, 2012, 10:59:40 AM9/26/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/10566#comment:9>

#10566: wxGTK-2.8.9 wxComboBox::SetFont() does not work
--------------------------------+-------------------------------------------
Reporter: ettl.martin | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 2.8.x
Keywords: wxComboBox SetFont | Blockedby:
Patch: 0 | Blocking: 10680
--------------------------------+-------------------------------------------
Changes (by rveerd):

* version: => 2.8.x


Comment:

This still does not work in wxWidgets 2.8.12 with GTK+ 2.24.10 on Ubuntu.
It appears this widget consists of multiple GTK widgets. Maybe the font is
not propagated to these widgets?

{{{
Frame::Frame(wxWindow* parent, wxWindowID id, const wxString& title)
: wxFrame(parent, id, title)
{
wxPanel* panel = new wxPanel(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
_T("Panel"));

const wxChar* choices[] = {
"Apples",
"Bananas",
"Cherries"};
size_t count = sizeof(choices) / sizeof(choices[0]);

wxFont font(wxFont(8, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL, false, _T("monospace")));

wxComboBox* combo = new wxComboBox(panel, wxID_ANY, choices[0],
wxPoint(10, 10), wxSize(200, 25), wxArrayString(count,
choices));
combo->SetFont(font); // Does not work; combo box uses the default
font.

wxChoice* choice = new wxChoice(panel, wxID_ANY,
wxPoint(10, 40), wxSize(200, 25), wxArrayString(count,
choices));
choice->SetFont(font); // Does work; choice uses the supplied
font.
}
}}}


--
Ticket URL: <http://trac.wxwidgets.org/ticket/10566#comment:9>

wxTrac

unread,
Sep 26, 2012, 12:20:11 PM9/26/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/10566#comment:10>

#10566: wxGTK-2.8.9 wxComboBox::SetFont() does not work
--------------------------------+-------------------------------------------
Reporter: ettl.martin | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 2.8.x
Keywords: wxComboBox SetFont | Blockedby:
Patch: 0 | Blocking: 10680
--------------------------------+-------------------------------------------

Comment(by mmarsan):

As Vadim said, in Gtk the fonts used for the "edit part" and the "list
part" may be different. They are the same when the widget is constructed.
But if you want to set a different font, currently wx just set the font
for the edit part, not for the list part.

Because this is not coherent with wxOwnerDrawnComboBox, nor with MSW, I
see two solutions:

1) Set also the same font to the list part of native ComboBox Gtk widget.

2) Add a new member SetListFont() to wxComboBox. So, both
wxOwnerDrawnComboBox and wxGTK ComboBox can show different fonts in edit
and list parts.

Native MSW ComboBox does not support different fonts, so SetListFont()
does nothing.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/10566#comment:10>
Reply all
Reply to author
Forward
0 new messages