Leser: 12
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
$Verbindung_Liste = $Top_Level -> Listbox( -selectmode => "single" ,
-activestyle => "none" ,
-width => 20 ,
-height => 10
) -> place( -x => 25 , -y => 27 );
$Verbindung_Liste -> bind( '<<ListboxSelect>>' , sub{ &Testumgebung() } );
sub Testumgebung {
my @Verbindung_Liste_Selektierung = $Verbindung_Liste -> curselection;
foreach ( @Verbindung_Liste_Selektierung )
{
my $Verbindung_Liste_Elemente = $Verbindung_Liste -> get( $_ );
our $Eintraege_Popups;
$Eintraege_Popups = $Verbindung_Liste -> Menu( -tearoff => 0 );
$Eintraege_Popups -> add( 'separator' );
$Eintraege_Popups -> add( 'command' , -label => "Eintrag 1 : $Verbindung_Liste_Elemente" , -command => \&item1 );
$Eintraege_Popups -> add( 'command' , -label => "Eintrag 2 : $Verbindung_Liste_Elemente" , -command => \&item2 );
$Verbindung_Liste -> bind( '<3>' , [ \&showmenu , Ev( 'X' ) , Ev( 'Y' ) , Ev( 'W' ) ] );
$Verbindung_Liste -> focus();
sub showmenu
{
my ( $self , $x , $y ) = @_;
$Eintraege_Popups -> post( $x , $y );
}
}
}
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
$ml = $Haupt_Fenster -> MListbox( -selectmode => 'single' ,
-height => 7 ,
-columns => [ [ -text => 'Laufende Nr.' , -resizeable => 0 , -sortable => 1 , -height => 11 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Bezeichnung' , -resizeable => 1 , -sortable => 1 , -height => 11 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Geburtstag' , -resizeable => 0 , -sortable => 1 , -height => 11 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Verfügbar' , -resizeable => 0 , -sortable => 1 , -height => 11 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Tel. - Nr.' , -resizeable => 0 , -sortable => 1 , -height => 11 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Mobil - Nr.' , -resizeable => 0 , -sortable => 1 , -height => 11 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Projekt - Nr.' , -resizeable => 0 , -sortable => 1 , -height => 11 , -width => 15 , -borderwidth => 0 ] ,
] ,
) -> place( -x => 251 , -y => 84 );
$ml -> insert( 'end' , [ "1000" , "Eintrag 1" , "01.01.1984" , "Sofort" ] );
$ml -> insert( 'end' , [ "1001" , "Eintrag 2" , "01.01.1983" , "Sofort" ] );
$ml -> bindRows( '<1>' , sub{ &Testumgebung } )
sub Testumgebung {
( $w , $infoHR ) = @_;
print "Ausgewaehlte Reihe : " . $infoHR -> { -row } . "\n" .
"Ausgewaehlte Zeile : " . $infoHR -> { -column } . "\n" ;
my @Verbindung_Liste_Selektierung = $ml -> curselection;
foreach( @Verbindung_Liste_Selektierung )
{
my @row = $ml -> getRow( $_ );
print @row;
our $Eintraege_Popups;
$Eintraege_Popups = $Haupt_Fenster -> Menu( -tearoff => 0 );
$Eintraege_Popups -> add( 'separator' );
$Eintraege_Popups -> add( 'command' , -label => "Eintrag 1 : " , -command => \&item1 );
$Eintraege_Popups -> add( 'command' , -label => "Eintrag 2 : " , -command => \&item2 );
$Haupt_Fenster -> bind( '<3>' , [ \&showmenu , Ev( 'X' ) , Ev( 'Y' ) , Ev( 'W' ) ] );
$Haupt_Fenster -> focus();
sub showmenu
{
my ( $self , $x , $y ) = @_;
$Eintraege_Popups -> post( $x , $y );
}
}
1
2
3
4
$Eintraege_Popups = $Haupt_Fenster -> Menu( -tearoff => 0 );
$Haupt_Fenster -> bind( '<3>' , [ \&showmenu , Ev( 'X' ) , Ev( 'Y' ) , Ev( 'W' ) ] );
$Haupt_Fenster -> focus()
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
#!/usr/bin/perl
# ------------------------------------------------------------------------------------------
use strict;
use warnings;
use Tk;
use utf8;
# ------------------------------------------------------------------------------------------
my $Haupt_Fenster;
my $mlistbox_inhalte;
my @auflistung_mlistbox_details;
------------------------------------------------------------------------------------------
&Haupt_Fenster( );
# ------------------------------------------------------------------------------------------
sub Haupt_Fenster {
$Haupt_Fenster = MainWindow -> new;
my $Breite = 640;
my $Hoehe = 480;
$Haupt_Fenster -> geometry( $Breite . 'x' . $Hoehe );
$Haupt_Fenster -> update;
my $Top_Level = $Haupt_Fenster -> toplevel;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
my $mlistbox_label = $Haupt_Fenster -> Label( -text => "" ,
-background => "white" ,
-height => 16 ,
-width => 140 ,
-relief => 'groove' ,
-anchor => "n"
) -> place( -x => 250 , -y => 83 );
my $mlistbox_frame = $Haupt_Fenster -> Frame( -background => 'white' ,
-borderwidth => 0 ,
-width => 842 ,
-height => 210 ,
-relief => 'groove'
) -> place( -x => 251 , -y => 85 );
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
use Tk::MListbox;
$mlistbox_inhalte = $mlistbox_frame -> MListbox ( -background => 'white' ,
-borderwidth => '0' ,
-columns => [ [ -text => 'Laufende Nr.' , -resizeable => 0 , -sortable => 1 , -height => 12 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Bezeichnung' , -resizeable => 1 , -sortable => 1 , -height => 12 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Geburtstag' , -resizeable => 0 , -sortable => 1 , -height => 12 , -width => 15 , -borderwidth => 0 ] ,
[ -text => 'Verfügbar' , -resizeable => 0 , -sortable => 1 , -height => 12 , -width => 15 , -borderwidth => 0 ] ,
] ,
-configurecommand => '1' ,
-cursor => 'plus' ,
-font => 'Times 8' ,
-foreground => 'black' ,
-height => 15 ,
-highlightcolor => 'pink' ,
-highlightbackground => 'white' ,
-moveable => '1' ,
-relief => 'groove' ,
-resizeable => '0' ,
-selectborderwidth => '1' ,
-selectbackground => 'black' ,
-selectforeground => 'yellow' ,
-selectmode => 'single' ,
-separatorcolor => 'black' ,
-sortable => '1' ,
-width => '930' ,
) -> place( -x => 0 , -y => 0 );
1
2
3
4
5
my $scrollbar = $mlistbox_inhalte -> Scrollbar( -orient => "vertical" );
$scrollbar -> place( -x => 833 , -y => 1 , -height => 207 , -width => 10 );
$mlistbox_inhalte -> configure( -yscrollcommand => [ 'set' , $scrollbar ] );
$scrollbar -> configure( -command => [ 'yview' => $mlistbox_inhalte ] );
1
2
3
4
5
$mlistbox_inhalte -> insert( 'end' , [ "1000" , "Datensatz 1" , "01.01.2015" , "Sofort" ] );
$mlistbox_inhalte -> insert( 'end' , [ "1001" , "Datensatz 2" , "01.01.2015" , "Sofort" ] );
$mlistbox_inhalte -> insert( 'end' , [ "1002" , "Datensatz 3" , "01.01.2015" , "Sofort" ] );
$mlistbox_inhalte -> insert( 'end' , [ "1003" , "Datensatz 4" , "01.01.2015" , "Sofort" ] );
$mlistbox_inhalte -> insert( 'end' , [ "1004" , "Datensatz 5" , "01.01.2015" , "Sofort" ] );
$mlistbox_inhalte -> bindRows( "<Button-3>" , [ \&mlistbox_inhalte_popups ] );
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
sub mlistbox_inhalte_popups {
my ( $w, $infoHR ) = @_;
my $menu = $w -> Menu( -tearoff => 0 );
my $index = $infoHR -> { '-column' };
print "Ausgewaehlte Reihe : " . $infoHR -> { -row } . "\n" .
"Ausgewaehlte Zeile : " . $infoHR -> { -column } . "\n" ;
my @auflistung_mlistbox = $w -> curselection;
foreach( @auflistung_mlistbox )
{
@auflistung_mlistbox_details; = $w -> getRow( $infoHR -> { -row } );
$menu -> add( 'command', -label => "Hide " . $w -> columnGet( $index ) -> cget( -text ) ,
-command => sub { $w -> columnHide( $index ); }
);
$menu -> add( 'separator' );
}
foreach ( $w -> columnGet( 0, 'end' ) )
{
unless ( $_ -> ismapped )
{
$menu -> add( 'command' , -label => "Show " . $_->cget( -text ) ,
-command => [ $w => 'columnShow', $_ ,
-before => $index ] ,
);
}
}
$menu -> Popup( -popover => 'cursor' );
}