wxToolBar problem Topic is solved

Это русская секция форума wxWidjets. В этой секции вы можете обсуждать любые вопросы, связанные с wxWidgets на вашем родном языке.
Post Reply
Dmitry Krutskih
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Dec 10, 2008 4:02 am
Contact:

wxToolBar problem

Post by Dmitry Krutskih » Mon Dec 29, 2008 6:03 am

В чем могут быть грабли? При создании тулбара последний растягивается на всю ширину окна. Но при изменении размера тулбар свой не меняет.

Вот код:

wxToolBar* CMainFrame::CreateToolBar()
{
wxToolBar* toolBar = new wxToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxTB_HORIZONTAL | wxTB_NODIVIDER | wxTB_FLAT );
toolBar->SetToolBitmapSize( wxSize( 22, 22 ) );

toolBar->AddTool( wxID_NEW, wxT( "New" ), wxBitmap( wxImage( wxT( "document-new22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "New Scene" ) );
toolBar->AddTool( wxID_OPEN, wxT( "Open" ), wxBitmap( wxImage( wxT( "document-open22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "Open Scene" ) );
toolBar->AddTool( wxID_SAVE, wxT( "Save" ), wxBitmap( wxImage( wxT( "document-save22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "Save Scene" ) );
toolBar->AddTool( wxID_SAVEAS, wxT( "Save As..." ), wxBitmap( wxImage( wxT( "document-save-as22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "Save Scene As" ) );
toolBar->AddSeparator();

toolBar->AddTool( wxID_EDIT_MOVE, wxT( "Move" ), wxBitmap( wxImage( wxT( "transform-move22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "Select and Move" ) );
toolBar->AddTool( wxID_EDIT_ROTATE, wxT( "Rotate" ), wxBitmap( wxImage( wxT( "transform-rotate22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "Select and Rotate" ) );
toolBar->AddTool( wxID_EDIT_SCALE, wxT( "Scale" ), wxBitmap( wxImage( wxT( "transform-scale22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "Select and Scale" ) );
toolBar->AddSeparator();

toolBar->AddTool( wxID_ABOUT, wxT( "About..." ), wxBitmap( wxImage( wxT( "help-about22.png" ), wxBITMAP_TYPE_PNG ) ), wxT( "Show about dialog" ) );

toolBar->Realize();

return toolBar;
}
Attachments
1.gif
1.gif (6.82 KiB) Viewed 1443 times
2.gif
2.gif (7.41 KiB) Viewed 1443 times

vtararin
Knows some wx things
Knows some wx things
Posts: 37
Joined: Thu May 24, 2007 4:43 pm
Location: Ukraine
Contact:

Post by vtararin » Mon Dec 29, 2008 8:57 am

Попробуйте создавать toolbar вот так, вместо явного вызова конструктора.

Code: Select all

    m_toolBar = CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, wxID_ANY);
cofounder of LogicLand Ltd.
my interest Kamenets-Podolskiy Online

User avatar
T-Rex
Moderator
Moderator
Posts: 1189
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex » Mon Dec 29, 2008 10:57 am

Или
void wxFrame::SetToolBar(wxToolBar* toolBar)
Associates a toolbar with the frame.

Dmitry Krutskih
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Dec 10, 2008 4:02 am
Contact:

Post by Dmitry Krutskih » Mon Dec 29, 2008 2:55 pm

Спасибо. Оба метода помогли.

Post Reply