Finalmente ho capito come fungono i sizers, solo che ora la finestra, o meglio il panel, è tagliato!
Normale e già non è della dimensione giusta!
Espanso, come si può vedere gli elementi sono tagliati e non si espandono!
Mi dite come si setta bene un panel??? Che flag deve avere??? Giusto per avere un panel che si ridimensiona insieme al freme!
Giusto per aiutarvi nella'aiutarmi, vi posto il codice del frame!
Codice: Seleziona tutto
graphManiaFrame::graphManiaFrame( const wxString& title, const wxPoint& pos, const wxSize& size )
: wxFrame((wxFrame *)NULL, -1, title, pos, size, wxDEFAULT_FRAME_STYLE)
{
// Menu presenti della finestra
// File
wxMenu *menuFile = new wxMenu;
// About
wxMenu *menuAbout = new wxMenu;
menuFile->Append(wxID_NEW, wxT("&Nuova partita\tCtrl+N"), wxT("Nuovo\t"));
menuFile->AppendSeparator();
menuFile->Append( wxID_EXIT, wxT( "E&xit" ) );
// Creazione menu ABOUT
menuAbout->Append(wxID_ABOUT, wxT("&About...\tF1"), wxT("Show about dialog"));
// TOOLBAR
wxToolBar* toolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxNO_BORDER);
// Icone toolbar
wxBitmap bmpOpen(open_xpm);
wxBitmap bmpSave(save_xpm);
toolBar->AddTool(wxID_OPEN, bmpOpen, wxT("Open"));
toolBar->AddSeparator();
toolBar->AddTool(wxID_SAVE, bmpSave, wxT("Save"));
toolBar->Realize();
SetToolBar(toolBar);
/* INSERIMENTO ELEMENTI NEL FRAME PRINCIPALE*/
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, wxT( "&File" ) );
menuBar->Append( menuAbout, wxT("&Help") );
SetMenuBar( menuBar );
/**********************************************************/
// Panel
//wxPanel* panel = new wxPanel(this, ID_PANEL, wxDefaultPosition, wxSize(LARGHEZZA, ALTEZZA));
wxPanel* panel = new wxPanel(this, ID_PANEL, wxDefaultPosition, wxDefaultSize);
wxBoxSizer *mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *textSizer = new wxBoxSizer( wxHORIZONTAL );
wxTextCtrl *numero1 = new wxTextCtrl( panel, wxID_ANY, wxT("My text.") );
wxStaticText *scritta = new wxStaticText( panel, wxID_ANY, wxT(" Testo descrittivo ") );
textSizer->Add(scritta, 1, wxEXPAND | wxALL, 10 );
textSizer->Add(numero1, 1, wxEXPAND | wxALL, 10 );
// Bottone OK
wxButton* ok = new wxButton(panel, wxID_OK, wxT("OK"));
wxButton* cancel = new wxButton(panel, wxID_CANCEL);
wxButton* help = new wxButton(panel, wxID_HELP);
wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer;
buttonSizer->AddButton(ok);
buttonSizer->AddButton(cancel);
buttonSizer->AddButton(help);
buttonSizer->Realize();
mainSizer->Add( textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
mainSizer->Add( buttonSizer, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
// PER ME UN PROBLEMA STA QUA!!!
mainSizer->Fit( this );
mainSizer->SetSizeHints( this );
panel->SetSizer( mainSizer );
// Icona del programma
SetIcon(wxICON(girandola32));
CreateStatusBar(2);
SetStatusText( wxT( "Scritta statusbar di benvenuto!" ), 0 );
SetStatusText(wxT( "---" ), 1 );
}
Help me, please! Thx