GUI enabling/disabling of controls: Difference between revisions
→{{header|Perl 6}}: Minimal fixes to make runnable
No edit summary |
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Minimal fixes to make runnable) |
||
Line 1,771:
Extremely basic implementation using the GTK library.
<lang perl6>use GTK::Simple;
use GTK::Simple::App;
my GTK::Simple::App $app .= new( title => 'Controls Enable / Disable' );
$app.
my $box = GTK::Simple::HBox.new(
my $inc = GTK::Simple::Button.new( label => ' + ' ),
Line 1,782 ⟶ 1,783:
);
$app.
$box.spacing = 10;
Line 1,790 ⟶ 1,791:
$dec.sensitive = $value.text > 0;
}
$value.text = '0';
$inc.clicked.tap: { my $val = $value.text; $val += 1; $value.text = $val.Str }
$dec.clicked.tap: { my $val = $value.text; $val -= 1; $value.text = $val.Str }
$app.run;</lang>
|