Advertisement
angeluzmortiz

Window replacement (Vala)

Feb 4th, 2014
2,418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 1.05 KB | None | 0 0
  1. Window cannot be replaced by another window via button.
  2.  
  3. using GLib;
  4. using Gtk;
  5.  
  6. public class AWE {
  7.  
  8.      public static int main (string [] args) {
  9.           Gtk.init(ref args);
  10.           new AWE();
  11.           Gtk.main();
  12.           return 0;
  13.      }
  14.      
  15.      Gtk.Window main_window = new Gtk.Window();
  16.      
  17.      AWE () {
  18.           X();
  19.           main_window.set_default_size(200,200);
  20.           main_window.set_position(Gtk.WindowPosition.CENTER);
  21.           main_window.show_all();
  22.           main_window.destroy.connect(Gtk.main_quit);
  23.      }
  24.      
  25.      public void X () {
  26.           main_window.title = "Test";
  27.           var btn = new Gtk.Button.with_label("Click here");
  28.           main_window.add(btn);
  29.          
  30.           btn.clicked.connect(() => {
  31.                Z();
  32.           });
  33.      }
  34.      
  35.      public void Z () {
  36.           var btn = new Gtk.Button.with_label("Click There");
  37.          
  38.           btn.clicked.connect(() => {
  39.                X();
  40.           });
  41.           main_window.set_default(btn);
  42.      
  43.      }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement