WxSizer --> modifier la taille et empécher le chevauchement

Résolu
cs_satellite34 Messages postés 688 Date d'inscription mercredi 6 avril 2005 Statut Membre Dernière intervention 2 juin 2006 - 30 août 2005 à 23:48
fredcl Messages postés 547 Date d'inscription mercredi 8 janvier 2003 Statut Membre Dernière intervention 7 octobre 2007 - 30 sept. 2005 à 11:27
Bonsoir,

Je travaille sur un dev qui contient plusieurs controles (3) dans une fenetre;

Il y a 2 sizers, et je voudrait que ces sizers redimmentionnent mes controles mais, en meme temps, fasse que les controles ne se chevauchent pas.

WxFlexGridSizer1 = new wxFlexGridSizer(2, 2, 0, 0);
WxFlexGridSizer2 = new wxFlexGridSizer(2, 2, 0, 0);

// BARRE DE MENUS
WxMenuBar1 = new wxMenuBar();


// FICHIER
wxMenu *ID_MNU_FICHIER_1021_Mnu_Obj = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_FICHIER_1021_Mnu_Obj, wxT("Fichier"));

ID_MNU_FICHIER_1021_Mnu_Obj->Append(wxID_NEW, wxT("Nouveau \tCtrl+N"), wxT("Nouveau"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(wxID_OPEN, wxT("Ouvrir \tCtrl+O"), wxT("Ouvrir"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(wxID_CLOSE, wxT("Fermer \tCtrl+F4"), wxT("Fermer la source"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_CLOSE_ALL, wxT("Tout fermer"), wxT("Fermer toutes les sources"), wxITEM_NORMAL);


ID_MNU_FICHIER_1021_Mnu_Obj->AppendSeparator();
wxMenu *ID_MNU_EXPORTER_1029_Mnu_Obj = new wxMenu(0);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_EXPORTER_1029, wxT("Exporter"), ID_MNU_EXPORTER_1029_Mnu_Obj);
ID_MNU_EXPORTER_1029_Mnu_Obj->Append(ID_MNU_EN_TXT_1033, wxT("en .txt"), wxT("exporter en texte"), wxITEM_NORMAL);
ID_MNU_EXPORTER_1029_Mnu_Obj->Append(ID_MNU_EN_HTML_1034, wxT("en .html"), wxT(""), wxITEM_NORMAL);
ID_MNU_EXPORTER_1029_Mnu_Obj->Append(ID_MNU_DSLEFORMATDULANGAGE_1035, wxT("dans le bon format"), wxT(""), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_IMPORTER_1030, wxT("Importer"), wxT("Importer des sources"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->AppendSeparator();
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_PROPRIETES, wxT("Propriétés"), wxT("Propriétés de la source"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_PRINT,wxT("Imprimer \tCtrl+I"),wxT("Imprimer"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->AppendSeparator();
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_QUIT, wxT("Quitter \tALT+F4"), wxT("Quitter le programme"), wxITEM_NORMAL);

// EDITION
wxMenu *ID_MNU_EDITION = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_EDITION, wxT("Edition"));

ID_MNU_EDITION->Append(wxID_UNDO, wxT("Annuler \tCtrl+Z"), wxT("Annuler une action"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_REDO, wxT("Refaire \tCtrl+Y"), wxT("Refaire une action"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(wxID_SELECTALL, wxT("Tout sélectionner \tCtrl+A"), wxT("Tout sélectionner"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_SELECTALL, wxT("Ne rien sélectionner \tCtrl+E"), wxT("Ne rien sélectionner"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(wxID_CUT, wxT("Couper \tCtrl+X"), wxT("Couper la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_COPY, wxT("Copier \tCtrl+C"), wxT("Copier la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_PASTE, wxT("Coller \tCtrl+V"), wxT("Coller la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(ID_CLEAR_ALL, wxT("Effacer tout \tCtrl+C"), wxT("Coller la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();

ID_MNU_EDITION->Append(myID_CHANGEUPPER, wxT("En majuscules"), wxT("Annuler une action"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(myID_CHANGELOWER, wxT("En miniscules"), wxT("Annuler une action"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(ID_OPTIONS, wxT("Préférences \tCtrl+P"), wxT("Préférences"), wxITEM_NORMAL);

// RECHERCHE
wxMenu *ID_MNU_SEARCH = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_SEARCH, wxT("Rechercher"));
ID_MNU_SEARCH->Append(wxID_FIND, wxT("Rechercher \tCtrl+F"), wxT("Rechercher dans la source"), wxITEM_NORMAL);
ID_MNU_SEARCH->Append(ID_SEARCH_NEXT, wxT("Rechercher suivant \tF3"), wxT("Rechercher suivant"), wxITEM_NORMAL);
ID_MNU_SEARCH->AppendSeparator();
ID_MNU_SEARCH->Append(ID_REPLACE, wxT("Remplacer \tCtrl+R"), wxT("Remplacer"), wxITEM_NORMAL);
ID_MNU_SEARCH->AppendSeparator();
ID_MNU_SEARCH->Append(ID_GO_TO, wxT("Aller à"), wxT("Aller à la ligne"), wxITEM_NORMAL);


// LIENS
wxMenu *ID_MNU_LINKS = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_LINKS, wxT("Liens"));
ID_MNU_LINKS->Append(ID_LINK_CPP, wxT("Cppfrance.com"), wxT("Visiter Cppfrance.com"), wxITEM_NORMAL);


// ?
wxMenu *ID_MNU_INFOS = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_INFOS, wxT("?"));
ID_MNU_INFOS->Append(ID_HELP, wxT("Aide \tF1"), wxT("Aide du programme"), wxITEM_NORMAL);
ID_MNU_INFOS->AppendSeparator();
ID_MNU_INFOS->Append(ID_REGISTER, wxT("Enregistrement"), wxT("Enregistrer le programme"), wxITEM_NORMAL);


ID_MNU_INFOS->Enable (ID_REGISTER, false);
ID_MNU_INFOS->Append(ID_UPDATE, wxT("Mise à jour"), wxT("Vérifier les mises à jour"), wxITEM_NORMAL);
ID_MNU_INFOS->Append(ID_DONATE, wxT("Faire un don"), wxT("Faire un don"), wxITEM_NORMAL);
ID_MNU_INFOS->AppendSeparator();
ID_MNU_INFOS->Append(ID_ABOUT, wxT("A propos"), wxT("A propos"), wxITEM_NORMAL);


// Création de la barre de status
WxStatusBar1 = new wxStatusBar(this, ID_WXSTATUSBAR1);
WxStatusBar1->SetFieldsCount(3);
WxStatusBar1->SetStatusText("Prêt",0);
SetStatusBar(WxStatusBar1);


// CREATION TOOLBAR
toolBar= CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,-1);
wxInitAllImageHandlers();
wxBitmap toolBarBitmaps[10];
toolBarBitmaps[0] = wxBitmap(new_xpm);
toolBarBitmaps[1] = wxBitmap(open_xpm);
toolBarBitmaps[2] = wxBitmap(save_xpm);
toolBarBitmaps[3] = wxBitmap(cut_xpm);
toolBarBitmaps[4] = wxBitmap(copy_xpm);
toolBarBitmaps[5] = wxBitmap(paste_xpm);
toolBarBitmaps[6] = wxBitmap(print_xpm);
toolBarBitmaps[7] = wxBitmap(help_xpm);
toolBarBitmaps[8] = wxBitmap(close_xpm);
toolBarBitmaps[9] = wxBitmap(closeall_xpm);
toolBar->SetToolBitmapSize(wxSize(20,20));
toolBar->AddTool(wxID_NEW, _T("Nouvelle source"), toolBarBitmaps[0], _T("Nouvelle source"));
toolBar->AddTool(wxID_OPEN, _T("Ouvrir un fichier"), toolBarBitmaps[1], _T("Ouvrir un fichier"));
toolBar->AddTool(ID_TOOLBAR2, "Sauvegarder", toolBarBitmaps[2], _T("Sauvegarder une source"));
toolBar->AddSeparator();
toolBar->AddTool(wxID_CUT, "Couper", toolBarBitmaps[3], _T("Couper"));
toolBar->AddTool(wxID_COPY, "Copier", toolBarBitmaps[4]);
toolBar->AddTool(wxID_PASTE, "Coller", toolBarBitmaps[5]);
toolBar->AddSeparator();
toolBar->AddTool(wxID_CLOSE, "Imprimer", toolBarBitmaps[6]);
toolBar->AddTool(ID_MNU_PROPRIETES, "Propriétés", toolBarBitmaps[7]);
toolBar->AddSeparator();
toolBar->AddTool(wxID_CLOSE, "Fermer", toolBarBitmaps[8]);
toolBar->AddTool(ID_MNU_CLOSE_ALL, "Tout fermer", toolBarBitmaps[9]);


toolBar->Realize();


ListLanguages = new wxComboBox(this, ID_ListLanguages, wxT("Choisissez un langage..."), wxPoint(5,5),
wxSize(145,21), arrayStringFor_ListLanguages, wxCB_SORT, wxDefaultValidator, wxT("ListLanguages"));


WxFlexGridSizer1->Add(ListLanguages, 0, wxALIGN_LEFT | wxALL,5);
WxFlexGridSizer1->Add(WxSearchField, 0, wxALIGN_LEFT | wxALL,5);


// LISTE SOURCES
WxListCtrl1 = new wxListCtrl(this, ID_WXLISTCTRL1, wxPoint(20,5), wxSize(140,LONGUEUR+30), wxLC_REPORT);
WxListCtrl1->InsertItem(1,"petit bout de code");
WxListCtrl1->InsertItem(2,"autre bout de code");
WxListCtrl1->InsertItem(3,"dernier bout de code");



wxListItem itemCol;
itemCol.SetWidth(136);


wxString NbreSources0 = "SOURCES";
itemCol.SetText(NbreSources0);
WxListCtrl1->InsertColumn(0, itemCol);

WxFlexGridSizer1->Add(WxListCtrl1, 0, wxALIGN_LEFT | wxALL);


// Onglets
WxNotebook1 = new wxNotebook(this, ID_WXNOTEBOOK1, wxPoint(20,20),wxSize(710,300));
WxNoteBookPage1 = new wxPanel(WxNotebook1, ID_WXNOTEBOOKPAGE1, wxPoint(4,24), wxSize(710,LONGUEUR),wxTAB_TRAVERSAL | wxCLOSE_BOX );
WxNotebook1->AddPage(WxNoteBookPage1, "Sans titre");
m_edit[0] = new Edit(WxNoteBookPage1,wxID_ANY,wxPoint(0,0),wxSize(710,300),wxHSCROLL | wxVSCROLL);
m_edit[0]->SetFocus();
WxFlexGridSizer1->Add(WxNotebook1, 5, wxALIGN_RIGHT | wxVERTICAL | wxHORIZONTAL |wxALL, 5);


WxFlexGridSizer2->Add(WxFlexGridSizer1, 2, wxALL|wxSHAPED, 5);


// Apparence de la frame
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
this->SetSize(8,8,900,500);
this->Center();
this->SetMenuBar(WxMenuBar1);
this->SetSizer(WxFlexGridSizer2);
}

@+
ROOT_DIEU Alias satellite34

10 réponses

fredcl Messages postés 547 Date d'inscription mercredi 8 janvier 2003 Statut Membre Dernière intervention 7 octobre 2007 1
1 sept. 2005 à 15:47
Bonjour,

Le code si dessous devrais fonctionner pour aficher l'editeur correctement:

wxPanel* WxNoteBookPage1 = new wxPanel(NoteBook, ID_PANEL1,
wxDefaultPosition, wxSize(200, 80),
wxTAB_TRAVERSAL);
wxBoxSizer* bSizer3 = new wxBoxSizer(wxHORIZONTAL);
WxNoteBookPage1->SetSizer(bSizer3);
wxStyledTextCtrl* Edit = new wxStyledTextCtrl(WxNoteBookPage1 ,
ID_EDIT,
wxDefaultPosition,
wxDefaultSize);
bSizer3->Add(Edit , 1, wxGROW|wxADJUST_MINSIZE, 0);
NoteBook->AddPage(WxNoteBookPage1 , "Code", TRUE);
3
cs_satellite34 Messages postés 688 Date d'inscription mercredi 6 avril 2005 Statut Membre Dernière intervention 2 juin 2006 1
31 août 2005 à 05:48
Re,

désolé mais c' est un dev que j' ai pris en cours derriere d' autres personnes;

j'ai arrangé le code pendant la nuit;ca donne a peu prés ce que je souhaite mais reste ce pb de chevauchements.Merci
1 code plus mieux(hé);je met toute la fonction qui m' interresse

sourcesFrm::sourcesFrm( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style )
: wxFrame( parent, id, title, position, size, style)
{
m_edit=new Edit*[1]; // nb objets
// Gestion des fichiers non sauvegardés
int taille = sizeof(Save) / sizeof(Save[0]);

for(int x=0; x<taille;x++)
{
Save[x] = 0;
}

WxFlexGridSizer1 = new wxFlexGridSizer(2, 0, 0);
WxFlexGridSizer2 = new wxFlexGridSizer(2, 0, 0);

// BARRE DE MENUS
WxMenuBar1 = new wxMenuBar();


// FICHIER
wxMenu *ID_MNU_FICHIER_1021_Mnu_Obj = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_FICHIER_1021_Mnu_Obj, wxT("Fichier"));

ID_MNU_FICHIER_1021_Mnu_Obj->Append(wxID_NEW, wxT("Nouveau \tCtrl+N"), wxT("Nouveau"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(wxID_OPEN, wxT("Ouvrir \tCtrl+O"), wxT("Ouvrir"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(wxID_CLOSE, wxT("Fermer \tCtrl+F4"), wxT("Fermer la source"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_CLOSE_ALL, wxT("Tout fermer"), wxT("Fermer toutes les sources"), wxITEM_NORMAL);


ID_MNU_FICHIER_1021_Mnu_Obj->AppendSeparator();
wxMenu *ID_MNU_EXPORTER_1029_Mnu_Obj = new wxMenu(0);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_EXPORTER_1029, wxT("Exporter"), ID_MNU_EXPORTER_1029_Mnu_Obj);
ID_MNU_EXPORTER_1029_Mnu_Obj->Append(ID_MNU_EN_TXT_1033, wxT("en .txt"), wxT("exporter en texte"), wxITEM_NORMAL);
ID_MNU_EXPORTER_1029_Mnu_Obj->Append(ID_MNU_EN_HTML_1034, wxT("en .html"), wxT(""), wxITEM_NORMAL);
ID_MNU_EXPORTER_1029_Mnu_Obj->Append(ID_MNU_DSLEFORMATDULANGAGE_1035, wxT("dans le bon format"), wxT(""), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_IMPORTER_1030, wxT("Importer"), wxT("Importer des sources"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->AppendSeparator();
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_PROPRIETES, wxT("Propriétés"), wxT("Propriétés de la source"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_PRINT,wxT("Imprimer \tCtrl+I"),wxT("Imprimer"), wxITEM_NORMAL);
ID_MNU_FICHIER_1021_Mnu_Obj->AppendSeparator();
ID_MNU_FICHIER_1021_Mnu_Obj->Append(ID_MNU_QUIT, wxT("Quitter \tALT+F4"), wxT("Quitter le programme"), wxITEM_NORMAL);

// EDITION
wxMenu *ID_MNU_EDITION = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_EDITION, wxT("Edition"));

ID_MNU_EDITION->Append(wxID_UNDO, wxT("Annuler \tCtrl+Z"), wxT("Annuler une action"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_REDO, wxT("Refaire \tCtrl+Y"), wxT("Refaire une action"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(wxID_SELECTALL, wxT("Tout sélectionner \tCtrl+A"), wxT("Tout sélectionner"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_SELECTALL, wxT("Ne rien sélectionner \tCtrl+E"), wxT("Ne rien sélectionner"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(wxID_CUT, wxT("Couper \tCtrl+X"), wxT("Couper la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_COPY, wxT("Copier \tCtrl+C"), wxT("Copier la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(wxID_PASTE, wxT("Coller \tCtrl+V"), wxT("Coller la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(ID_CLEAR_ALL, wxT("Effacer tout \tCtrl+C"), wxT("Coller la sélection"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();

ID_MNU_EDITION->Append(myID_CHANGEUPPER, wxT("En majuscules"), wxT("Annuler une action"), wxITEM_NORMAL);
ID_MNU_EDITION->Append(myID_CHANGELOWER, wxT("En miniscules"), wxT("Annuler une action"), wxITEM_NORMAL);
ID_MNU_EDITION->AppendSeparator();
ID_MNU_EDITION->Append(ID_OPTIONS, wxT("Préférences \tCtrl+P"), wxT("Préférences"), wxITEM_NORMAL);

// RECHERCHE
wxMenu *ID_MNU_SEARCH = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_SEARCH, wxT("Rechercher"));
ID_MNU_SEARCH->Append(wxID_FIND, wxT("Rechercher \tCtrl+F"), wxT("Rechercher dans la source"), wxITEM_NORMAL);
ID_MNU_SEARCH->Append(ID_SEARCH_NEXT, wxT("Rechercher suivant \tF3"), wxT("Rechercher suivant"), wxITEM_NORMAL);
ID_MNU_SEARCH->AppendSeparator();
ID_MNU_SEARCH->Append(ID_REPLACE, wxT("Remplacer \tCtrl+R"), wxT("Remplacer"), wxITEM_NORMAL);
ID_MNU_SEARCH->AppendSeparator();
ID_MNU_SEARCH->Append(ID_GO_TO, wxT("Aller à"), wxT("Aller à la ligne"), wxITEM_NORMAL);


// LIENS
wxMenu *ID_MNU_LINKS = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_LINKS, wxT("Liens"));
ID_MNU_LINKS->Append(ID_LINK_CPP, wxT("Cppfrance.com"), wxT("Visiter Cppfrance.com"), wxITEM_NORMAL);


// Infos
wxMenu *ID_MNU_INFOS = new wxMenu(0);
WxMenuBar1->Append(ID_MNU_INFOS, wxT("?"));
ID_MNU_INFOS->Append(ID_HELP, wxT("Aide \tF1"), wxT("Aide du programme"), wxITEM_NORMAL);
ID_MNU_INFOS->AppendSeparator();
ID_MNU_INFOS->Append(ID_REGISTER, wxT("Enregistrement"), wxT("Enregistrer le programme"), wxITEM_NORMAL);


ID_MNU_INFOS->Enable (ID_REGISTER, false);
ID_MNU_INFOS->Append(ID_UPDATE, wxT("Mise à jour"), wxT("Vérifier les mises à jour"), wxITEM_NORMAL);
ID_MNU_INFOS->Append(ID_DONATE, wxT("Faire un don"), wxT("Faire un don"), wxITEM_NORMAL);
ID_MNU_INFOS->AppendSeparator();
ID_MNU_INFOS->Append(ID_ABOUT, wxT("A propos"), wxT("A propos"), wxITEM_NORMAL);


// Création de la barre de status
WxStatusBar1 = new wxStatusBar(this, ID_WXSTATUSBAR1);
WxStatusBar1->SetFieldsCount(3);
WxStatusBar1->SetStatusText("Prêt", 0);
SetStatusBar(WxStatusBar1);


// CREATION TOOLBAR
toolBar= CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,-1);
wxInitAllImageHandlers();
wxBitmap toolBarBitmaps[10];
toolBarBitmaps[0] = wxBitmap(new_xpm);
toolBarBitmaps[1] = wxBitmap(open_xpm);
toolBarBitmaps[2] = wxBitmap(save_xpm);
toolBarBitmaps[3] = wxBitmap(cut_xpm);
toolBarBitmaps[4] = wxBitmap(copy_xpm);
toolBarBitmaps[5] = wxBitmap(paste_xpm);
toolBarBitmaps[6] = wxBitmap(print_xpm);
toolBarBitmaps[7] = wxBitmap(help_xpm);
toolBarBitmaps[8] = wxBitmap(close_xpm);
toolBarBitmaps[9] = wxBitmap(closeall_xpm);
toolBar->SetToolBitmapSize(wxSize(20,20));
toolBar->AddTool(wxID_NEW, _T("Nouvelle source"), toolBarBitmaps[0], _T("Nouvelle source"));
toolBar->AddTool(wxID_OPEN, _T("Ouvrir un fichier"), toolBarBitmaps[1], _T("Ouvrir un fichier"));
toolBar->AddTool(ID_TOOLBAR2, "Sauvegarder", toolBarBitmaps[2], _T("Sauvegarder une source"));
toolBar->AddSeparator();
toolBar->AddTool(wxID_CUT, "Couper", toolBarBitmaps[3], _T("Couper"));
toolBar->AddTool(wxID_COPY, "Copier", toolBarBitmaps[4]);
toolBar->AddTool(wxID_PASTE, "Coller", toolBarBitmaps[5]);
toolBar->AddSeparator();
toolBar->AddTool(wxID_CLOSE, "Imprimer", toolBarBitmaps[6]);
toolBar->AddTool(ID_MNU_PROPRIETES, "Propriétés", toolBarBitmaps[7]);
toolBar->AddSeparator();
toolBar->AddTool(wxID_CLOSE, "Fermer", toolBarBitmaps[8]);
toolBar->AddTool(ID_MNU_CLOSE_ALL, "Tout fermer", toolBarBitmaps[9]);


toolBar->Realize();


//liste des array strings de ListLanguags
wxArrayString arrayStringFor_ListLanguages;
arrayStringFor_ListLanguages.Add(wxT("ASP"));
arrayStringFor_ListLanguages.Add(wxT("C"));
arrayStringFor_ListLanguages.Add(wxT("C++"));
arrayStringFor_ListLanguages.Add(wxT("HTML"));
arrayStringFor_ListLanguages.Add(wxT("Java"));
arrayStringFor_ListLanguages.Add(wxT("PHP"));
arrayStringFor_ListLanguages.Add(wxT("VB"));
arrayStringFor_ListLanguages.Add(wxT("XHTML"));
arrayStringFor_ListLanguages.Add(wxT("XML"));
arrayStringFor_ListLanguages.Add(wxT("Delphi"));
arrayStringFor_ListLanguages.Add(wxT("CSS"));
arrayStringFor_ListLanguages.Add(wxT("Javascript"));
ListLanguages = new wxComboBox(this, ID_ListLanguages, wxT("Choisissez un langage..."), wxPoint(5, 5),
wxSize(145,21), arrayStringFor_ListLanguages, wxCB_SORT, wxDefaultValidator, wxT("ListLanguages"));


// LISTE SOURCES
WxListCtrl1 = new wxListCtrl(this, ID_WXLISTCTRL1, wxPoint(5,30), wxSize(140,LONGUEUR+30), wxLC_REPORT);
WxListCtrl1->InsertItem(1,"petit bout de code");
WxListCtrl1->InsertItem(2,"autre bout de code");
WxListCtrl1->InsertItem(3,"dernier bout de code");



wxListItem itemCol;
itemCol.SetWidth(136);


wxString NbreSources0 = "SOURCES";
itemCol.SetText(NbreSources0);
WxListCtrl1->InsertColumn(0, itemCol);


// Onglets
WxNotebook1 = new wxNotebook(this, ID_WXNOTEBOOK1, wxPoint(170, 20), wxSize(710, 300));
WxNoteBookPage1 = new wxPanel(WxNotebook1, ID_WXNOTEBOOKPAGE1, wxPoint(0, 0), wxSize(710,LONGUEUR), 0);
WxNotebook1->AddPage(WxNoteBookPage1, "Sans titre");
m_edit[0] = new Edit(WxNoteBookPage1, wxID_ANY,wxPoint(5, 170), wxSize(710, LONGUEUR), wxHSCROLL | wxVSCROLL);
m_edit[0]->SetFocus();

WxFlexGridSizer1->Add(WxNotebook1, 5, wxALIGN_RIGHT | wxALL | wxSHAPED, 5);
WxFlexGridSizer1->Add(WxNoteBookPage1, 5, wxALIGN_RIGHT | wxALL | wxSHAPED, 5);
WxFlexGridSizer1->Add(m_edit[0], 5, wxALIGN_RIGHT | wxALL | wxSHAPED, 5);
WxFlexGridSizer1->Add(WxSearchField, 5, wxALIGN_RIGHT | wxALL | wxSHAPED, 5);


WxFlexGridSizer2->Add(WxFlexGridSizer1, 5, wxALIGN_RIGHT | wxALL | wxSHAPED, 5);


// Apparence de la frame
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
this->SetSize(8,8,900,500);
this->Center();
this->SetMenuBar(WxMenuBar1);
this->SetSizer(WxFlexGridSizer2);
}

en fait, je veux que le note book et ces éléments ne puisse pas passer dessous les autres controles qui eux sont figés a gauche de la frame;
Je pense, que je veux définir un point d'arret au sizer (hum, chui pas bien sur la...).
Merci.

@+
ROOT_DIEU Alias satellite34
0
fredcl Messages postés 547 Date d'inscription mercredi 8 janvier 2003 Statut Membre Dernière intervention 7 octobre 2007 1
31 août 2005 à 09:07
Bonjour,


C'est vrai que c'est pas clair!
Bon apparement certain contrôles sont dans des wxSizer d'autres non, et c'est la qu'est le problème :
Soit tu utilises les wxSizer pour tous les contrôles.
Soit tu ne les utilises pour aucun.
Si tu pouvais poster une petite copie d'écran de ta fenêtre (ou même un dessin de ce que tu veux) ça permettrais de voir clairement la position des éléments et te fournir un exemple concret.

Cordialement

FredCL
0
cs_satellite34 Messages postés 688 Date d'inscription mercredi 6 avril 2005 Statut Membre Dernière intervention 2 juin 2006 1
1 sept. 2005 à 02:27
Bonsoir,

Je me prends bien le tete avec ces sizers :-)

Donc, je cree mes 2 sizers

WxFlexGridSizer1 = new wxFlexGridSizer(2, 0, 0);
WxFlexGridSizer2 = new wxFlexGridSizer(2, 0, 0);

je met les controles dans le sizer 1

WxFlexGridSizer1->Add(WxListCtrl1, 2, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL | wxSHAPED, 5);
WxFlexGridSizer1->Add(ListLanguages, 2, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL | wxSHAPED, 5);

WxFlexGridSizer1->Add(WxNotebook1, 2, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL | wxSHAPED, 5);
WxFlexGridSizer1->Add(WxNoteBookPage1, 2, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL | wxSHAPED, 5);
WxFlexGridSizer1->Add(m_edit[0], 2, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL | wxSHAPED, 5);
WxFlexGridSizer1->Add(WxSearchField, 2, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL | wxSHAPED, 5);


trés certainement l'erreur se trouve la !

je met le sizer 1 dans le sizer 2

WxFlexGridSizer2->Add(WxFlexGridSizer1, 2, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_VERTICAL | wxRIGHT | wxSHAPED, 5);

alors la, niveau flags, je sais pas trop quoi mettre;

et avec ca j' obtiens http://satellitesound.free.fr/SIZE.JPG

Et, en fait, je veux http://satellitesound.free.fr/NOSIZE.JPG
Mais sizé et de maniere a ce que les 3 parties ne se chevauchent pas;

Quelles sont mes erreurs?? Est-ce que je m' y prends bien??
Devrai-je, vu la mise en forme, utiliser un autre sizer que wxFlexGridSizer??

Merci;
@+
ROOT_DIEU Alias satellite34
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
fredcl Messages postés 547 Date d'inscription mercredi 8 janvier 2003 Statut Membre Dernière intervention 7 octobre 2007 1
1 sept. 2005 à 09:31
Bonjour,

Je n'arrive pas à joindre les deux adresses que tu as communiqué.


Pourrais-tu vérifiez leur validité? Ou poster l'image directement ici.


Cordialement


FredCL
0
fredcl Messages postés 547 Date d'inscription mercredi 8 janvier 2003 Statut Membre Dernière intervention 7 octobre 2007 1
1 sept. 2005 à 12:29
Bonjour,

Ok c'est bon, j'ai réussi à récupérer l'image.
Je regarde comment arriver au bon résultat et je poste tout ça

A+

Cordialement

FredCL
0
fredcl Messages postés 547 Date d'inscription mercredi 8 janvier 2003 Statut Membre Dernière intervention 7 octobre 2007 1
1 sept. 2005 à 12:51
Bonjour,

Voici un exemple d'utilisation des wxSizer qui afficherais les contrôles comme tu le souhaites :

wxBoxSizer* bSizerH = new wxBoxSizer(wxHORIZONTAL);
SetSizer(bSizerH);

wxBoxSizer* bSizerV = new wxBoxSizer(wxVERTICAL);
bSizerH->Add(bSizerV, 0, wxGROW|wxALL, 5);

wxComboBox* comboBox = new wxComboBox(this, ID_COMBOBOX, wxEmptyString,
wxDefaultPosition, wxDefaultSize, 0,
NULL, wxCB_DROPDOWN);
bSizerV->Add(comboBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

wxListBox* listBox = new wxListBox(this, ID_LISTBOX, wxDefaultPosition,
wxDefaultSize, 0, NULL, wxLB_SINGLE);
bSizerV->Add(listBox, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

wxNotebook* noteBook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition,
wxDefaultSize, wxNB_TOP);
bSizerH->Add(noteBook, 1, wxGROW|wxALL, 5);

Cordialement

FredCL
0
cs_satellite34 Messages postés 688 Date d'inscription mercredi 6 avril 2005 Statut Membre Dernière intervention 2 juin 2006 1
1 sept. 2005 à 15:18
Bonjour,

Tout d' abord merci pour ton exemple , ça marche super bien, les controles ne se chevauchent pas et se size correctement.

Cependant, il me reste un petit souci à éclaircir(le dernier avec les sizers je pense):

Dans mon notebook j' ai un wxPanel et un wxStyledTextCtrl;
Lorsque je n' ai que le notebook dans le sizer ca marche super mais dés que je met le panel et l' edit, ca ne marche plus et j' obtient :
http://satellitesound.free.fr/RESIZE.JPG

le note book change de taille et le panel et l'edit ne sont plus la!

voila le code que j' utilise :

// Sizers
bSizerH = new wxBoxSizer(wxHORIZONTAL);

bSizerV = new wxBoxSizer(wxVERTICAL);
bSizerH->Add(bSizerV, 0, wxGROW|wxALL, 5);

this->SetSizer(bSizerH);

bSizerV->Add(ListLanguages, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
bSizerV->Add(WxListCtrl1, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

bSizerH->Add(WxNotebook1, 1, wxGROW|wxALL, 5);
bSizerH->Add(WxNoteBookPage1, 1, wxGROW|wxALL, 5);//wxPanel
bSizerH->Add(m_edit[0], 1, wxGROW|wxALL, 5); //wxStyledTextCtrl

//fin des sizers

Enfin, si vous avez un peu de temps pour m' expliquer en quoi réside les principales différences entre les différent types de sizers et dans quelle situation utiliser tel ou tel sizer ca serai simpa.

event.Merci();
@+;
ROOT_DIEU Alias satellite34
0
boutonnet Messages postés 13 Date d'inscription dimanche 26 novembre 2000 Statut Membre Dernière intervention 18 novembre 2005 1
27 sept. 2005 à 14:58
Bonjour, je galere actuellement pour positionner correctement mes
controles sur ma Frame. Je debute et connais a peine les sizers .

Je dispose d'un wxTextCtrl et d'une wxListCtrl. Je voudrais les
afficher sur toute la longueur et la largeur de ma Frame avec
wxListCtrl a gauche et wxTextCtrl a droite.



Pour l'instant , j'ai cree trois wxBoxSizer avec un dans lequel je met
ma "List" , un autre mon "TextCtrl" et un dernier dans lequel je
positionne ces deux wxBoxSizer



voici mon code ::



//------------------------------------------------------------------------------

// Constructeur de la classe Frame...

//------------------------------------------------------------------------------

Frame::Frame(const wxString& title, const wxPoint& pos, const wxSize& size,


long style) : wxFrame(NULL, -1, title, pos, size, style)

{

SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));



//Mise en place du menu

wxMenu *menuFichier = new wxMenu;

menuFichier->Append(Nouveau,"Nouveau \tCtrl+T");

menuFichier->Append(Ouvrir,"Ouvrir \tCtrl+O");

menuFichier->AppendSeparator();

menuFichier->Append(Enregister,"Enregister sous...");

menuFichier->AppendSeparator();

menuFichier->Append(App_Quit,"Quitter l'application");



wxMenu *menuOption = new wxMenu;

menuOption->Append(Police,"Police");

menuOption->Append(Couleur,"Couleur du fond");



wxMenu *menuAide = new wxMenu;

menuAide->Append(APropos,"A Propos !");



wxMenuBar *menuBarre = new wxMenuBar();

menuBarre->Append(menuFichier,("&Fichier"));

menuBarre->Append(menuOption,("&Options"));

menuBarre->Append(menuAide,("&Aide"));

SetMenuBar(menuBarre);



//mise en place du sizer

Psize = new wxBoxSizer(wxHORIZONTAL);

sizeEdit = new wxBoxSizer(wxVERTICAL);

sizeList = new wxBoxSizer(wxVERTICAL);



//wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint&
pos wxDefaultPosition, const wxSize& size wxDefaultSize, long
style wxLC_ICON, const wxValidator& validator
wxDefaultValidator, const wxString& name = wxListCtrlNameStr)



//Mise en place du ListCtrl pour l'affichage du nom des sequences

ListNameSeq = new wxListCtrl(this,NameEdit,wxDefaultPosition,wxDefaultSize,



wxLC_ICON,wxDefaultValidator,wxListCtrlNameStr);



sizeList->Add(ListNameSeq,wxALL);



// const wxSize * siz = new wxSize(100,200);



//Mise en place de l'editeur

editeur = new EditSequence(this,TextEdit,"",wxDefaultPosition,wxSize(200,80),


wxHSCROLL |
wxTE_MULTILINE,wxDefaultValidator,"");



sizeEdit->Add(editeur,wxALL);



Psize->Add(sizeList,wxALIGN_LEFT);

Psize->Add(sizeEdit,wxALIGN_RIGHT);



//On donne le sizer a la Frame

this->SetSizer(Psize,wxALL);

}



Si on peut m'aider, c cool

merci
0
fredcl Messages postés 547 Date d'inscription mercredi 8 janvier 2003 Statut Membre Dernière intervention 7 octobre 2007 1
30 sept. 2005 à 11:27
Bonjour,



Je pense que le plus simple serais ceci :



// Un Sizer horizontal pour pouvoir mettre les contrôles horizontalement les un à coté des autres

wxBoxSizer* horzBoxSizer = new wxBoxSizer(wxHORIZONTAL);

SetSizer(horzBoxSizer);



wxListBox* listBox = new wxListBox( this,
ID_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE );

// wxGROW pour indiquer l'expansion sur toute la hauteur

horzBoxSizer->Add(listBox, 0, wxGROW, 0);



wxTextCtrl* textCtrl = new wxTextCtrl( this,
ID_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE );

// wxGROW pour indiquer l'expansion sur toute la hauteur et 1 pour indiquer l'expension sur la largeur restante

horzBoxSizer->Add(textCtrl, 1, wxGROW, 0);



Cordialement



FredCL
0
Rejoignez-nous