Personal tools
You are here: Home cmgui Wiki button.com

button.com

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();

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.