Bonjour,

Je chercher à créer un conteneur élégant, où la partie inférieur peut être cachée ou affichée grâce à un bouton (c'est typiquement ce qui est utilisé par les IDE pour afficher les messages du compilateur).

Sachant que je souhaite aussi donner la possibilité à l'utilisateur de redimentionner la zone, je me base sur un GtkVPaned, mais impossible de placer correctement la séparation lors de l'affichage (après, si je cache puis réaffiche le widget, c'est parfait).

Voici le brouillon de mon widget :
Code c# : 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
public class Valide.SmartVPaned : Gtk.VPaned
{
  private Gtk.HBox hbox;
  private Gtk.Widget child;
  private const int DEFAULT_SIZE = 700;
 
  [Callback]
  private void expande (Gtk.Button sender)
  {
    if (this.child.visible == true)
    {
      this.child.visible = false;
      sender.image = new Gtk.Image.from_stock (Gtk.STOCK_GO_UP, Gtk.IconSize.SMALL_TOOLBAR);
      this.position = Window.get_instance ().default_height;
    }
    else
    {
      this.child.visible = true;
      sender.image = new Gtk.Image.from_stock (Gtk.STOCK_GO_DOWN, Gtk.IconSize.SMALL_TOOLBAR);
      this.position = this.DEFAULT_SIZE;
    }
  }
 
  construct
  {
    this.hbox = new Gtk.HBox (false, 0);
 
    Gtk.VBox vbox = new Gtk.VBox (false, 0);
    this.hbox.pack_start (vbox, false, false, 0);
 
    Gtk.Button button = new Gtk.Button ();
    button.relief = Gtk.ReliefStyle.NONE;
    button.image = new Gtk.Image.from_stock (Gtk.STOCK_GO_DOWN, Gtk.IconSize.SMALL_TOOLBAR);
    button.clicked += this.expande;
 
    vbox.pack_start (button, false, false, 0);
    this.position = this.DEFAULT_SIZE;
  }
 
  public void show ()
  {
    base.show ();
    this.position = this.DEFAULT_SIZE;
  }
 
  public void add2 (Gtk.Widget child)
  {
    this.child = child;
    base.add2 (this.hbox);
    this.hbox.pack_start (this.child, true, true, 0);
    this.position = this.DEFAULT_SIZE;
  }
}

Je change la position du séparateur à 3 endroits :
  1. A la création du widget
  2. A l'affichage
  3. Lors de l'ajout du second widget


Mais rien y fait