How place correctly GtkVPaned separtor?



Hello,

I want set position of GtkVPaned, but I don't understand when set
position attribut for separator correctly show when widget showing.

My new class (write in Vala) :

---
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;
  }
}
---

I set the default position at three locations:

   1. In widget constructor
   2. In show function
   3. In add2 function

But sepator appears on top. However, after show/hide, the separator
displays correctly.

Thanks in advance.
-- 
Nicolas Joseph

Responsable de la rubrique GTK+ de developpez.com

http://nicolasj.developpez.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]