#!/usr/bin/perl -w
use strict;
use Wx;
package MyFrame;
#use base qw(Wx::Frame);
use vars qw(@ISA);
@ISA = qw(Wx::Frame);
# import the event registration function
use Wx::Event qw(EVT_BUTTON);
use Wx::Event qw(EVT_CHECKLISTBOX);
sub new {
my $ref = shift;
my $self = $ref->SUPER::new( undef, # parent window
-1, # Fenter id
'WxPerl Window', # Titel
[60,-1], # Position x/y
[870, 500] # Größe x/y
);
# load an icon and set it as frame icon
$self->SetIcon( Wx::GetWxPerlIcon() );
# controls should not be placed directly inside
# a frame, use a Wx::Panel instead
my $panel = Wx::Panel->new( $self, # parent window
-1, # ID
);
# create the bündel checklistbox überschrift
my $b_text = Wx::StaticText->new( $panel, # parent window
-1, # ID
'Dateien', # label
[30, 80], # position
[-1, -1], # default size
);
# create the bündel checklistbox
my $leftchecklistbox = Wx::CheckListBox->new( $panel,
-1,
[30, 100],
[400, 220],
[ qw(Full_Package_1 Upd_Package_1_1 Upd_Package_1_2 Upd_Package_1_3
Full_Package_2 Upd_Package_2_2 Full_Package_3 Upd_Package_3_1 Upd_Package_3_2) ]
);
# create the daten übernehmen button
my $du_button = Wx::Button->new( $panel, # parent window
-1, # ID
'Datei laden', # label
[30, 330], # position
[-1, -1], # default size
);
# register the OnClick method as an handler for the
# 'button clicked' event. The first argument is a Wx::EvtHandler
# that receives the event
EVT_BUTTON( $self, $du_button, \&OnClick );
# create the pakete checklistbox überschrift
my $p_text = Wx::StaticText->new( $panel, # parent window
-1, # ID
'Auswahl', # label
[440, 80], # position
[-1, -1], # default size
);
my $rightchecklistbox = Wx::CheckListBox->new( $panel, # parent window
-1, # ID
[440, 100], # position
[400, 220],
); # default size
# create the daten löschen button
my $dl_button = Wx::Button->new( $panel, # parent window
-1, # ID
'Daten löschen', # label
[440, 330], # position
[-1, -1], # default size
);
# register the OnClick method as an handler for the
# 'button clicked' event. The first argument is a Wx::EvtHandler
# that receives the event
EVT_BUTTON( $self, $dl_button, \&OnClick );
# create the makecd button
my $mi_button = Wx::Button->new( $panel, # parent window
-1, # ID
'CD-Images erzeugen', # label
[720, 330], # position
[120, -1], # default size
);
# register the OnClick method as an handler for the
# 'button clicked' event. The first argument is a Wx::EvtHandler
# that receives the event
EVT_BUTTON( $self, $mi_button, \&OnClick );
# create a status bar
my $status = Wx::StatusBar->new( $self, -1 );
$status -> SetFieldsCount( 1 );
$status -> SetStatusText( "Programm gestartet!" );
$self->SetStatusBar($status);
return $self;
}
# this method receives as its first parameter the first argument
# passed to the EVT_BUTTON function. The second parameter
# always is a Wx::Event subclass
sub OnClick {
my( $self, $event ) = @_;
# Question: Which button was pressed????
my $b_pressed = "dont know";
# Ausgewählte Dateien einlesen und in Liste einfügen
# Question: Wie????
$self -> SetStatusText("Daten wurden aktualisiert!");
}
package MyWindow; # Definition des obersten Objekts
use base qw(Wx::App); # Inherit from Wx::App
sub OnInit {
my $frame = MyFrame->new;
$frame->Show( 1 );
}
package main;
my $wxobj = MyWindow->new(); #Hier wird die Anwendung gestartet
$wxobj->MainLoop;