[vala][gtk] souci dans l'utilisation de notebook
bonjour à toutes et à tous,
je tente d'utiliser Gtk.Notebook
le souci : depuis un onglet, quand on
crée un nouvel onglet, il n'apparait pas
Code:
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
|
using Gtk;
/*
valac --pkg gtk+-3.0 test.vala && ./test
*/
public Gtk.Window win;
public Gtk.Notebook ntb;
public class ong {
public Gtk.Button btn { get; set; }
public Gtk.Label lab { get; set; }
public int np { get; set; }
public void aff(int valeur) {
this.np=valeur;
string str=np.to_string();
GLib.stdout.printf("aff %s\n",str);
this.btn=new Gtk.Button.with_label(str);
this.btn.clicked.connect( () => {
GLib.stdout.printf("\tbtn %s\n",str);
this.np+=1;
ong nt=new ong();
nt.aff(this.np);
});
this.lab=new Gtk.Label(str);
ntb.append_page(this.btn,this.lab);
}
}
int main(string[] args) {
Gtk.init(ref args);
win=new Gtk.Window();
win.set_default_size(640,320);
win.destroy.connect(() => { Gtk.main_quit(); });
ntb=new Gtk.Notebook();
for ( int n=0;n<3;n++ ) {
ong ntab=new ong();
ntab.aff(n);
}
win.add(ntb);
win.show_all();
Gtk.main();
return 0;
} |
je ne vois pas comment avancer
si vous pouviez au moins m'aiguiller...
s'il vous faut plus d'infos...
merci d'avance