Re: [Vala] viewport ADD



Hi,

you ask on wrong mailing list, try on Gtk mailing list.

m.

2013/1/12 "Luis L. Rodríguez Oro" <luisr uci cu>:
How can I add object to the viewport??

//valac --pkg gtk+-3.0 viewport.vala
public class Application : Gtk.Window {
    private Gtk.Viewport viewport;
    private Gtk.ScrolledWindow scrolled;

    public Application () {
        // Prepare Gtk.Window:
        this.title = "My Gtk.Viewport";
        this.window_position = Gtk.WindowPosition.CENTER;
        this.destroy.connect (Gtk.main_quit);
        this.set_default_size (200, 200);

        // ScrolledWindow:
        scrolled = new Gtk.ScrolledWindow (null, null);
        this.add (scrolled);

        // The Viewport:
        viewport = new Gtk.Viewport (null, null);
        viewport.set_size_request (200, 200);

        update();

        scrolled.add (viewport);
        Timeout.add(1000, update);
    }

    private bool update(){
        string name = " aaa";
        var mail_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 5);
        var mail_grid = new Gtk.Grid ();

        mail_grid.attach (new Gtk.Label("data:"), 0, 1, 1, 1);
        mail_grid.attach (new Gtk.Label("value" + name), 1, 1, 1, 1);
        mail_grid.attach (new Gtk.Label("data:"), 0, 2, 1, 1);
        mail_grid.attach (new Gtk.Label("value" + name), 1, 2, 1, 1);
        mail_grid.attach (new Gtk.Label("data:"), 0, 3, 1, 1);
        mail_grid.attach (new Gtk.Label("value" + name), 1, 3, 1, 1);

        mail_box.pack_start(mail_grid, true, true);
        mail_box.pack_start(new Gtk.Separator(Gtk.Orientation.HORIZONTAL),
true, true);
        viewport.add(mail_box);

        return true;
    }

    public static int main (string[] args) {
        Gtk.init (ref args);

        Application app = new Application ();
        app.show_all ();

        Gtk.main ();
        return 0;
    }
}


10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS
INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list



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