Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add a tested small GTK# sample
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; |