Check Buttons

Gamma/GTK: Using Gamma™ with GTK, Version 0.9
Prev | Appendix A. Example Code | Next

# A.4. Check Buttons

    function create_check_buttons ()
    {
      local	box1, box2, separator, button;

      win_check_buttons = new (GtkWindow);
      win_check_buttons.signal ("destroy", #win_check_buttons = nil);
      win_check_buttons.title = "GtkCheckButton";
      win_check_buttons.border_width = 0;

      box1 = new (GtkVBox);
      win_check_buttons.add (box1);

      box2 = new (GtkVBox);
      box2.border_width = 10;
      box2.spacing = 10;
      box1.pack_start (box2, TRUE, TRUE, 0);

      button = gtk_check_button_new_with_label("button1");
      box2.pack_start (button, TRUE, TRUE, 0);

      button = gtk_check_button_new_with_label("button2");
      box2.pack_start (button, TRUE, TRUE, 0);

      button = gtk_check_button_new_with_label("button3");
      box2.pack_start (button, TRUE, TRUE, 0);

      separator = new (GtkHSeparator);
      box1.pack_start (separator, FALSE, TRUE, 0);

      box2 = new (GtkVBox);
      box2.border_width = 10;
      box1.pack_start (box2, FALSE, TRUE, 0);

      button = new (GtkButton);
      button.label = "close";
      button.signal ("clicked", `(@win_check_buttons).destroy());
      box2.pack_start (button, TRUE, TRUE, 0);
      button.can_default = TRUE;
      button.grab_default();

      win_check_buttons.show_all();
      win_check_buttons;
    }

    function main ()
    {
      local window, win_check_buttons;
      TRUE=1;
      FALSE=0;
      window = create_check_buttons ();
      window.signal ("destroy", #exit_program(0));
      init_ipc("check_buttons", "check_buttonsq");
      gtk_main ();
    }

Prev | Home | Next
Buttons | Up | Dialog

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.