Combobox (or any control) inside a toolbar on linux Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
riruilo
Knows some wx things
Knows some wx things
Posts: 48
Joined: Sat Jul 14, 2007 10:38 pm

Combobox (or any control) inside a toolbar on linux

Post by riruilo »

Hi friends!

I
Last edited by riruilo on Fri Jul 20, 2007 9:01 pm, edited 1 time in total.
I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif »

Yes.

You can create a combo/choice/etc on a toolbar and port it to linux.

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
riruilo
Knows some wx things
Knows some wx things
Posts: 48
Joined: Sat Jul 14, 2007 10:38 pm

Post by riruilo »

So, why that message? I dont understand

thanks!
I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte »

riruilo wrote:So, why that message? I dont understand

thanks!
What message?

You just need to compile the "toolbar" sample on Linux and test it to see that it works.
riruilo
Knows some wx things
Knows some wx things
Posts: 48
Joined: Sat Jul 14, 2007 10:38 pm

Post by riruilo »

Excuse me, the source code was not completed.


// the generic toolbar doesn't really support this
#if wxUSE_TOOLBAR_NATIVE && !defined(__WXX11__) || defined(__WXUNIVERSAL__)
// adding a combo to a vertical toolbar is not very smart
if ( !( toolBar->IsVertical() ) )
{
wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1),0, NULL, wxCB_READONLY ,wxDefaultValidator, _T("comboBox") );

combo->Append(_T("This"));
combo->Append(_T("is a"));
combo->Append(_T("combobox"));
combo->Append(_T("in a"));
combo->Append(_T("toolbar"));
combo->SetSelection(0);

toolBar->AddControl(combo);

wxSpinCtrl *spin = new wxSpinCtrl( toolBar, ID_SPIN, wxT("0"), wxDefaultPosition, wxSize(80,wxDefaultCoord), 0, 0, 100 );
toolBar->AddControl( spin );

wxTextCtrl *text = new wxTextCtrl( toolBar, -1, wxT("text"), wxDefaultPosition, wxSize(80,wxDefaultCoord) );
toolBar->AddControl( text );

wxSearchCtrl *srch = new wxSearchCtrl( toolBar, -1, wxT("xx"), wxDefaultPosition, wxSize(80,wxDefaultCoord), wxSUNKEN_BORDER );
toolBar->AddControl( srch );
}
#endif // toolbars which don't support controls



What I dont understand is why the code says "the generic toolbar doesn't really support this". And the define "#if wxUSE_TOOLBAR_NATIVE && !defined(__WXX11__) || defined(__WXUNIVERSAL__) ".

Thank you.
I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched C-beams glitter in the dark near the Tannhauser gate. All those moments will be lost in time, like tears in rain. Time to die.
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte »

I don't remember why the generic implementation of wxToolbar does not support wxComboBox... maybe it was tested only with wxButtons ??

Anyway, I don't think you are using this configuration, but native implementations on each platform, so you don't have to worry.
Post Reply