Simple windowed application: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 280:
return 0;
}</lang>
 
=={{header|C sharp|C#}}==
 
<lang csharp>using System.Windows.Forms;
 
class RosettaForm : Form
{
RosettaForm()
{
var clickCount = 0;
 
var label = new Label();
label.Text = "There have been no clicks yet.";
label.Dock = DockStyle.Top;
Controls.Add(label);
 
var button = new Button();
button.Text = "Click Me";
button.Dock = DockStyle.Bottom;
button.Click += delegate
{
clickCount++;
label.Text = "Number of clicks: " + clickCount + ".";
};
Controls.Add(button);
}
 
static void Main()
{
Application.Run(new RosettaForm());
}
}
</lang>
 
=={{header|C++}}==
Line 338 ⟶ 371:
}</lang>
 
=={{header|C sharp|C#}}==
 
<lang csharp>using System.Windows.Forms;
 
class RosettaForm : Form
{
RosettaForm()
{
var clickCount = 0;
 
var label = new Label();
label.Text = "There have been no clicks yet.";
label.Dock = DockStyle.Top;
Controls.Add(label);
 
var button = new Button();
button.Text = "Click Me";
button.Dock = DockStyle.Bottom;
button.Click += delegate
{
clickCount++;
label.Text = "Number of clicks: " + clickCount + ".";
};
Controls.Add(button);
}
 
static void Main()
{
Application.Run(new RosettaForm());
}
}
</lang>
=={{header|Clojure}}==
<lang clojure>(ns counter-window
Line 396 ⟶ 397:
(.setVisible true))))
</lang>
 
=={{header|Common Lisp}}==
 
Line 764 ⟶ 766:
 
CloseApp(0)</lang>
 
 
=={{header|F_Sharp|F#}}==
Line 1,000 ⟶ 1,001:
 
</lang>
 
=={{header|Go}}==
{{libheader|go-gtk}}
Line 1,160 ⟶ 1,162:
end</lang>
 
=={{header|J}}==
'''J 8.x'''
Line 1,954 ⟶ 1,957:
# Main loop.
Gtk->main;</lang>
 
=={{header|Perl 6}}==
{{libheader|GTK}}
<lang perl6>use GTK::Simple;
use GTK::Simple::App;
 
my GTK::Simple::App $app .= new(title => 'Simple Windowed Application');
 
$app.size-request(350, 100);
 
$app.set-content(
GTK::Simple::VBox.new(
my $label = GTK::Simple::Label.new( text => 'There have been no clicks yet'),
my $button = GTK::Simple::Button.new(label => 'click me'),
)
);
 
$app.border-width = 40;
 
$button.clicked.tap: {
state $clicks += 1;
$label.text = "There has been $clicks click{ 's' if $clicks != 1 }";
}
 
$app.run;</lang>
 
=={{header|Phix}}==
Line 2,406 ⟶ 2,384:
(send frame show #t)
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
{{libheader|GTK}}
<lang perl6>use GTK::Simple;
use GTK::Simple::App;
 
my GTK::Simple::App $app .= new(title => 'Simple Windowed Application');
 
$app.size-request(350, 100);
 
$app.set-content(
GTK::Simple::VBox.new(
my $label = GTK::Simple::Label.new( text => 'There have been no clicks yet'),
my $button = GTK::Simple::Button.new(label => 'click me'),
)
);
 
$app.border-width = 40;
 
$button.clicked.tap: {
state $clicks += 1;
$label.text = "There has been $clicks click{ 's' if $clicks != 1 }";
}
 
$app.run;</lang>
 
=={{header|RapidQ}}==
10,333

edits