IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

wxWidgets Discussion :

Problème de sizer


Sujet :

wxWidgets

  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    268
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 268
    Par défaut Problème de sizer
    Bonjour,

    Je souhaite obtenir une présentation composée de 4 panels comme le montre l'image ci-dessous :



    J'utilises des wxBoxSizer pour mettre en page tout ca :

    - un wxHORIZONTAL avec les panels 3 et 4.
    - un wxVERTICAL avec le panel 2 et le wxBoxSizer précédent.

    Puis dans mon wxBoxSizer principal, qui est wxHORIZONTAL, j'ajoute le panel 1 puis le précédent wxBoxSizer.
    Seulement ce que j'obtiens ne correspond pas du tout. Une idée sur la manière propre de procéder ?

    Merci.

  2. #2
    Rédacteur
    Avatar de 3DArchi
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    7 634
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 7 634
    Par défaut
    Salut,
    Ton problème de rendu est peut être du à la taille minimal et aux paramètres proportion et wxEXPAND que tu as pu positionner.
    Cependant, au vu de ce que tu présentes, tu devrais jeter un coup d'oeil aux auiAdvance (cf wxAui overview).

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    268
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 268
    Par défaut
    En fait, je ne souhaite pas utiliser wxAUI.
    Je souhaite seulement assembler mes wxPanel comme sur l'image.

    Mon cheminement avec les wxBoxSizer est pourtant correct non ? J'ai essayé de changer les min. size, de jouer avec les wxEXPAND ainsi que le paramètre proportion, mais j'ai toujours les wxPanel qui se chevauchent ...

  4. #4
    Rédacteur
    Avatar de 3DArchi
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    7 634
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 7 634
    Par défaut
    Un bout de code ?

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    268
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 268
    Par défaut
    Citation Envoyé par 3DArchi Voir le message
    Un bout de code ?
    Bien sûr :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    // creation des panels
    	_panel_1 = new Panel1(this, wxDefaultSize);
    	_panel_2 = new Panel2(this, wxDefaultSize);
    	_panel_3 = new Panel3(this, wxDefaultSize);
    	_panel_4 = new Panel4(this, wxDefaultSize);
     
    	// creation des static box
    	wxStaticBoxSizer* bSizer1 = new wxStaticBoxSizer(wxVERTICAL, _panel_1, "Panel 1");
    	wxStaticBoxSizer* bSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, _panel_2, "Panel 2");
    	wxStaticBoxSizer* bSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, _panel_3, "Panel 3");
    	wxStaticBoxSizer* bSizer4 = new wxStaticBoxSizer(wxHORIZONTAL, _panel_4, "Panel 4");
     
    	// panels 3 et 4
    	wxBoxSizer* box = new wxBoxSizer(wxHORIZONTAL);
    	box->Add(bSizer3, 1, wxEXPAND | wxBOTTOM | wxRIGHT, SPC);
    	box->Add(bSizer4, 1, wxEXPAND | wxBOTTOM | wxRIGHT, SPC);
     
    	// panel 2 (+ panels 3 et 4)
    	wxBoxSizer* box2 = new wxBoxSizer(wxVERTICAL);
    	box2->Add(bSizer1, 1, wxEXPAND | wxBOTTOM | wxRIGHT, SPC);
    	box2->Add(box, 0, wxEXPAND);
     
    	// main sizer (panel 1 = les autres)
    	wxBoxSizer* mainSizer = new wxBoxSizer(wxHORIZONTAL);
    	mainSizer->Add(bSizer4, 1, wxEXPAND | wxBOTTOM | wxRIGHT, SPC);
    	mainSizer->Add(box2, 0, wxEXPAND);
    	SetSizer(mainSizer);

  6. #6
    Rédacteur
    Avatar de 3DArchi
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    7 634
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 7 634
    Par défaut
    1/ Tu t'es embrouillé dans tes chiffres : l'ajout des panneaux ne correspond pas à ce que tu dis.
    2/ Le paramètre passé au constructeur de wxStaticBoxSizer n'est pas une fenêtre à ajouter mais le parent du wxStaticBox qui encadre le sizer. Ce doit être dans ton cas this (le panel).
    3/ Donc, il faut rajouter les panels aux sizers correspondant.
    Ce qui donne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
     
    // creation des panels
    	_panel_1 = new Panel1(this, wxDefaultSize);
    	_panel_2 = new Panel2(this, wxDefaultSize);
    	_panel_3 = new Panel3(this, wxDefaultSize);
    	_panel_4 = new Panel4(this, wxDefaultSize);
     
    	// creation des static box
    	wxStaticBoxSizer* bSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, "Panel 1");
       bSizer1->Add(_panel_1,1,wxEXPAND);
    	wxStaticBoxSizer* bSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, "Panel 2");
       bSizer2->Add(_panel_2,1,wxEXPAND);
    	wxStaticBoxSizer* bSizer3 = new wxStaticBoxSizer(wxHORIZONTAL, this, "Panel 3");
       bSizer3->Add(_panel_3,1,wxEXPAND);
    	wxStaticBoxSizer* bSizer4 = new wxStaticBoxSizer(wxHORIZONTAL, this, "Panel 4");
       bSizer4->Add(_panel_4,1,wxEXPAND);
     
    	// panels 3 et 4
    	wxBoxSizer* box = new wxBoxSizer(wxHORIZONTAL);
    	box->Add(bSizer3, 1, wxEXPAND | wxBOTTOM | wxRIGHT);
    	box->Add(bSizer4, 1, wxEXPAND | wxBOTTOM | wxRIGHT);
     
    	// panel 2 (+ panels 3 et 4)
    	wxBoxSizer* box2 = new wxBoxSizer(wxVERTICAL);
    	box2->Add(bSizer2, 1, wxEXPAND | wxBOTTOM | wxRIGHT);
    	box2->Add(box, 0, wxEXPAND);
     
    	// main sizer (panel 1 = les autres)
    	wxBoxSizer* mainSizer = new wxBoxSizer(wxHORIZONTAL);
    	mainSizer->Add(bSizer1, 1, wxEXPAND | wxBOTTOM | wxRIGHT);
    	mainSizer->Add(box2, 0, wxEXPAND);
    	SetSizer(mainSizer);
    Pourquoi passer par des wxStaticBoxSizer?

    Pour faciliter la chose, je sortirais l'artillerie design Pattern (monteur, fabrique, prototype).

  7. #7
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    268
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 268
    Par défaut
    Merci 3DArchi en effet c'était ça le problème!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 2
    Dernier message: 17/11/2008, 21h03
  2. Problème wx.Notebook et Sizer
    Par Lotendan dans le forum wxPython
    Réponses: 2
    Dernier message: 03/09/2008, 17h55
  3. Problème sizer - décalage
    Par micromich dans le forum wxWidgets
    Réponses: 2
    Dernier message: 07/08/2008, 18h13
  4. Problème de disposition (layout, sizer ..)
    Par Grummfy dans le forum wxPython
    Réponses: 2
    Dernier message: 08/09/2007, 15h48
  5. Problème d'installation oracle 8.1.7 sous NT
    Par Anonymous dans le forum Installation
    Réponses: 7
    Dernier message: 02/08/2002, 14h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo