Simple windowed application: Difference between revisions

Content added Content deleted
(→‎{{libheader|Perl/Gtk}}: Link to general GTK category and perl specific page.)
m (→‎{{header|Sidef}}: minor code simplifications)
Line 2,104: Line 2,104:


=={{header|Sidef}}==
=={{header|Sidef}}==
<lang ruby>require('Gtk2') -> init;
<lang ruby>require('Gtk2') -> init


# Window.
# Window.
var window = %s'Gtk2::Window'.new;
var window = %s<Gtk2::Window>.new
window.signal_connect('destroy' => func(*_) { %s'Gtk2'.main_quit });
window.signal_connect('destroy' => { %s<Gtk2>.main_quit })


# VBox.
# VBox.
var vbox = %s'Gtk2::VBox'.new(0, 0);
var vbox = %s<Gtk2::VBox>.new(0, 0)
window.add(vbox);
window.add(vbox)


# Label.
# Label.
var label = %s'Gtk2::Label'.new('There have been no clicks yet.');
var label = %s<Gtk2::Label>.new('There have been no clicks yet.')
vbox.add(label);
vbox.add(label)


# Button.
# Button.
var count = 0;
var count = 0
var button = %s'Gtk2::Button'.new(' Click Me ');
var button = %s<Gtk2::Button>.new(' Click Me ')
vbox.add(button);
vbox.add(button)
button.signal_connect('clicked' => func(*_) {
button.signal_connect('clicked' => {
label.set_text(++count);
label.set_text(++count)
});
})


# Show.
# Show.
window.show_all;
window.show_all


# Main loop.
# Main loop.
%s'Gtk2'.main;</lang>
%s<Gtk2>.main</lang>


=={{header|Smalltalk}}==
=={{header|Smalltalk}}==