Leser: 2
9 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl -w
use strict;
use Wx;
#
# Wx::Frame mit einem Button erweitern
#
package MyFrame;
use base qw(Wx::Frame);
sub new
{
my $class = shift;
my $self = $class->SUPER::new(@_);
# Then define a Panel to put the button on
my $panel = Wx::Panel->new( $self, # parent
-1 # id
);
$self->{btn} = Wx::Button->new( $panel, # parent
1, # id
" Drück mich ", # label
[50,20] # position
);
return $self;
}
#
# Wx::App mit unserer Button - Klasse erweitern
#
package ButtonClass;
use base qw(Wx::App);
sub OnInit
{
my $self = shift;
my $frame = MyFrame->new( undef,
-1,
'Button - Klasse',
[-1,-1],
[200, 100]
);
$self->SetTopWindow($frame);
$frame->Show(1);
}
#
# Hauptprogramm
#
package main;
my $wxobj = ButtonClass->new();
$wxobj->MainLoop;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl -w
use strict;
use Wx;
# Wx::App mit unserer Button - Klasse erweitern
package ButtonClass;
use base qw(Wx::App);
use Wx::Event qw(EVT_BUTTON);
sub OnInit {
my $self = shift;
my $frame = Wx::Frame->new( undef, -1, 'Button - Klasse', [-1,-1], [200, 100]);
my $panel = Wx::Panel->new( $frame, -1);
$panel->{button} = Wx::Button->new( $panel, 1, " Drück mich ", [50,20]);
EVT_BUTTON($panel, $panel->{button}, sub {$self->Close(1);});
$self->SetTopWindow($frame);
$frame->Show(1);
}
# Hauptprogramm
package main;
my $wxobj = ButtonClass->new();
$wxobj->MainLoop;
9 Einträge, 1 Seite |