Thread Perl/Tk: eingebettetes Toplevel-Fenster: Toplevel nur im MainWindow verschiebbar? (5 answers)
Opened by pusher at 2006-01-27 12:12

Gast Gast
 2006-01-28 17:00
#45211 #45211
Sicher... hier ist ein kleines Beispiel mit zwei Unterfenstern.

Code: (dl )
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
use Tk;
use Tk::MDI; # implement MDI module
use strict;

my $MW = MainWindow->new;
$MW->configure(-title => "Testfenster");

#
# build menubar
#
my $menubar = $MW->Menu;
my $menu_file = $menubar->cascade(-label => "~File", -tearoff => 0);
my $menu_edit = $menubar->cascade(-label => "~Edit", -tearoff => 0);
my $menu_help = $menubar->cascade(-label => "~Help", -tearoff => 0);
$menu_file->command(-label => 'Exit',
-command => sub { $MW->destroy() } );
$menu_edit->command(-label => 'does nothing');
$menu_help->command(-label => 'does nothing');
$MW->configure(-menu => $menubar);

#
# convert MainWindow into MDI window
# "window" menu entry will be cascaded into existing menu structure
#
my $MDI = $MW->MDI(-style => 'win32',
-background => 'white');
#
# create two child windows
# child windows can be treated as "normal" widgets
#
my $child1 = $MDI->add(-titletext => 'child window');
my $child2 = $MDI->add(-titletext => 'child window');
$child1->Button(-text => "does nothing")->pack;
my $listbox = $child2->Listbox(-width => 200, -height => 100)->pack;
$listbox->insert(1,'entry 1');

MainLoop;


Grüße

Thorsten

View full thread Perl/Tk: eingebettetes Toplevel-Fenster: Toplevel nur im MainWindow verschiebbar?