![]() |
![]() |
4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/perl
use strict;
use Tk;
use Tk::LabFrame;
use File::Basename;
# *****************************************************************************
# ** Generiere HAUPTMENÜ ******************************************************
# *****************************************************************************
my $mw = MainWindow->new;
$mw->title("Ein TEST mit LISTBOX");
# *****************************************************************************
# ** Generiere Menü AUSWAHL DES DIRECTORIES ***********************************
# *****************************************************************************
my $laden = $mw->LabFrame(-label=>'[ 1--> Auswahl des Directories ]', -labelside=>'acrosstop')
->pack (-side =>'top', -expand=>1, -fill=>'x');
my $laden_button = $laden->Button(-text=>'Auswählen', -command=> \&Load_Path)
->pack (-side=>'left', -expand=>0, -fill=>'none');
my $laden_entry = $laden->Entry(-width=>100)
->pack (-side=>'left', -expand=>1, -fill=>'x');
# *****************************************************************************
# ** Generiere LISTBOX ********************************************************
# *****************************************************************************
my $listbox_frame = $mw->LabFrame(-label =>'[ 2--> Programme-Auswählen ]',
-labelside =>'acrosstop')
->pack (-side =>'top',
-expand=>'1',
-fill =>'x');
my $Auswahl_Liste = $listbox_frame->Listbox("width" => 70,
"height" => 5,
-selectmode => 'extended')
->pack(-side => 'left');
my $doit_btn = $listbox_frame->Button(-text =>'Ausgewählte Programme ausführen',
-command => \&Run_Perl_Prog)
->pack(-side =>'left',
-expand=>0);
my $Select_All = $listbox_frame->Button(-text =>'Alles auswählen',
-command => \&leeres_info_fenster)
->pack(-side =>'left',
-expand=>0);
my $De_Select_All = $listbox_frame->Button(-text =>'Alles abwählen',
-command => \&leeres_info_fenster)
->pack(-side =>'left',
-expand=>0);
MainLoop();
# *****************************************************************************
# ** Sub LOAD PATH ************************************************************
# *****************************************************************************
sub Load_Path {
my $file_typ = [
['PERL Program', '.pl' ],
['All Files', '*' ],
];
my $dn = $mw->getOpenFile(-filetypes=>$file_typ);
my $file = $dn;
my $dn = dirname($file);
if (defined $dn and $dn ne '') {
$laden_entry->delete(0, 'end');
$laden_entry->insert('end', $dn);
my @files = glob($dn.'/*.pl');
$_ = basename($_) for(@files); # <---Nur FILE NAME übrig lassen.
$Auswahl_Liste->delete(0, 'end')
if(@files);
$Auswahl_Liste->insert('end', @files)
}
}
# *****************************************************************************
# ** Sub Run_Perl_Prog ********************************************************
# *****************************************************************************
sub Run_Perl_Prog {
my $Get_Path = $laden_entry->get();
my $Get_File_Name = $Auswahl_Liste->get($Auswahl_Liste->curselection());
my $slash = "/";
if(!$Get_Path || $Get_Path eq ''){
$mw->messageBox(-message=> " Zuerst ein Programm auswählen.",
-type => "OK"),
return 1;
}
my $tmp_1 = "$Get_Path$slash$Get_File_Name";
my $tmp_2 = qx($^X $tmp_1);
}
# *****************************************************************************
# ** Info-Fenster *************************************************************
# *****************************************************************************
sub leeres_info_fenster {
my $popup = $mw->Dialog(
-popover => $mw,
-title => 'Info Fenster',
-bitmap => 'Tk',
-default_button => 'OK',
-buttons => ['OK'],
-text => "Diese Funktion ist im Moment nicht implementiert. \n".
" \n".
"Bis später. \n".
" \n".
"Danke.",
);
$popup->resizable('no', 'no');
$popup->Show();
}
1
2
3
4
my $Select_All = $listbox_frame->Button(
-text =>'Alles auswählen',
-command => sub { $Auswahl_Liste->selectionSet(0, 'end'); }
);
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/perl
use strict;
use Tk;
use Tk::LabFrame;
use File::Basename;
# *****************************************************************************
# ** Generiere HAUPTMENÜ ******************************************************
# *****************************************************************************
my $mw = MainWindow->new;
$mw->title("Ein TEST mit LISTBOX");
# *****************************************************************************
# ** Generiere Menü AUSWAHL DES DIRECTORIES ***********************************
# *****************************************************************************
my $laden = $mw->LabFrame(-label=>'[ 1--> Auswahl des Directories ]', -labelside=>'acrosstop')
->pack (-side =>'top', -expand=>1, -fill=>'x');
my $laden_button = $laden->Button(-text=>'Auswählen', -command=> \&Load_Path)
->pack (-side=>'left', -expand=>0, -fill=>'none');
my $laden_entry = $laden->Entry(-width=>100)
->pack (-side=>'left', -expand=>1, -fill=>'x');
# *****************************************************************************
# ** Generiere LISTBOX und BUTTONS ********************************************
# *****************************************************************************
my $listbox_frame = $mw->LabFrame(-label =>'[ 2--> Programme-Auswählen ]',
-labelside =>'acrosstop')
->pack (-side =>'top',
-expand=>'1',
-fill =>'x');
my $Auswahl_Liste = $listbox_frame->Listbox("width" => 70,
"height" => 5,
-selectmode => 'extended')
->pack(-side => 'left');
my $doit_btn = $listbox_frame->Button(-text =>'Ausgewählte Programme ausführen',
-command => \&Run_Perl_Prog)
->pack(-side =>'left', -expand=>0);
my $Select_All = $listbox_frame->Button(-text =>'Alles auswählen',
-command => sub { $Auswahl_Liste->selectionSet(0, 'end');})
->pack(-side =>'left', -expand=>0);
my $De_Select_All = $listbox_frame->Button(-text =>'Alles abwählen',
-command => sub { $Auswahl_Liste->selectionClear(0, 'end');})
->pack(-side =>'left', -expand=>0);
MainLoop();
# *****************************************************************************
# ** Sub LOAD PATH ************************************************************
# *****************************************************************************
sub Load_Path {
my $file_typ = [
['PERL Program', '.pl' ],
['All Files', '*' ],
];
my $dn = $mw->getOpenFile(-filetypes=>$file_typ);
my $file = $dn;
my $dn = dirname($file);
if (defined $dn and $dn ne '') {
$laden_entry->delete(0, 'end');
$laden_entry->insert('end', $dn);
my @files = glob($dn.'/*.pl');
$_ = basename($_) for(@files); # <---Nur FILE NAME übrig lassen.
$Auswahl_Liste->delete(0, 'end')
if(@files);
$Auswahl_Liste->insert('end', @files)
}
}
# *****************************************************************************
# ** Sub Run_Perl_Prog ********************************************************
# *****************************************************************************
sub Run_Perl_Prog {
my $Get_Path = $laden_entry->get();
my $Get_File_Name = $Auswahl_Liste->get($Auswahl_Liste->curselection());
my $slash = "/";
if(!$Get_Path || $Get_Path eq ''){
$mw->messageBox(-message=> " Zuerst ein Programm auswählen.",
-type => "OK"),
return 1;
}
my $tmp_1 = "$Get_Path$slash$Get_File_Name";
my $tmp_2 = qx($^X $tmp_1);
}
# *****************************************************************************
# ** Info-Fenster *************************************************************
# *****************************************************************************
sub leeres_info_fenster {
my $popup = $mw->Dialog(
-popover => $mw,
-title => 'Info Fenster',
-bitmap => 'Tk',
-default_button => 'OK',
-buttons => ['OK'],
-text => "Diese Funktion ist im Moment nicht implementiert. \n".
" \n".
"Bis später. \n".
" \n".
"Danke.",
);
$popup->resizable('no', 'no');
$popup->Show();
}
![]() |
![]() |
4 Einträge, 1 Seite |