Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a tested small GTK# sample
  • Loading branch information
sorear committed Sep 10, 2011
1 parent 76367f7 commit ad1fcdd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/gtk1.pl
@@ -0,0 +1,30 @@
# Translated from http://www.mono-project.com/GtkSharp:_Hello_World

constant $GTK = "gtk-sharp,Version=2.12.0.0,Culture=neutral,PublicKeyToken=35e10195dab3c99f";

constant Application = CLR::("Gtk.Application,$GTK");
constant Window = CLR::("Gtk.Window,$GTK");
constant Button = CLR::("Gtk.Button,$GTK");

Application.Init;

# Set up a button object.
my $btn = Button.new("Hello World");
$btn.add_Clicked: sub ($obj, $args) { #OK
# runs when the button is clicked.
say "Hello World";
Application.Quit;
};

my $window = Window.new("helloworld");
$window.add_DeleteEvent: sub ($obj, $args) { #OK
# runs when the user deletes the window using the "close
# window" widget in the window frame.
Application.Quit;
};

# Add the button to the window and display everything
$window.Add($btn);
$window.ShowAll;

Application.Run;

0 comments on commit ad1fcdd

Please sign in to comment.