Thread Menu->configure() (8 answers)
Opened by Froschpopo at 2005-04-15 10:46

ptk
 2005-04-15 21:58
#43577 #43577
User since
2003-11-28
3645 Artikel
ModeratorIn
[default_avatar]
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
use Tk;
$mw = tkinit;

$mw->optionAdd("*tearOff", 0);
$m = $mw->Menu
(-menuitems =>
[
[Cascade => "~File", -menuitems =>
[
[Button => "~Open"],
[Button => "~Reload"],
[Button => "~Quit"],
[Cascade => "~Cascade", -menuitems =>
[
[Button => "~Foobar"],
]
]
]
]
]
);
$mw->configure(-menu => $m);

# Disable Foobar:
$m->entrycget(0, -menu)->entrycget(3, -menu)->entryconfigure(0, -state => "disabled");

MainLoop;


Mit den Tear-Offs muss man vorsichtig sein: wenn sie aktiviert sind, muss man den Index immer um eins erhoehen.

View full thread Menu->configure()