Personal tools
You are here: Home / cmgui / Wiki / button.com
Navigation
Log in


Forgot your password?
 

use CmGtk;

CmGtk->init();

{ my($window,$button);

#Unforunately the Cmiss interpreter will not let you lay out the following command on multiple lines. $window = new Gtk::Widget("GtkWindow", type => -toplevel, title => "CmGtk Sample", allow_grow => 0, allow_shrink => 0, border_width => 10);

$create_window_button = new Gtk::Widget("Gtk::Button", label => "Create window", visible => 1); $create_window_button->signal_connect( "clicked", \&gfx;_create_window );

$destroy_window_button = new Gtk::Widget("Gtk::Button", label => "Destroy Window", visible => 1); $destroy_window_button->signal_connect( "clicked", \&gfx;_destroy_window, $create_window_button );

my $box = new Gtk::VBox(); $box->spacing( 15 ); $box->add( $create_window_button ); $box->add( $destroy_window_button );

$window->add( $box ); $window->border_width( 15 );

$window->show_all(); }

sub gfx_create_window { my( $button ) = @_;

gfx cre win 1; $button->set_sensitive(0); }

sub gfx_destroy_window { my( $button, $create_window_button ) = @_;

gfx des win 1; $create_window_button->set_sensitive(1); }

#Making the Destroy Button have sensible sensitivity is an exercise #which I will leave to the student. :-)

CmGtk->main();