Deutsch   English   Franšais   Italiano  
<2e53a960-68a4-4e3c-b667-00ce364f9344@googlegroups.com>

View for Bookmarking (what is this?)
Look up another Usenet article
   

X-Received: by 10.112.133.232 with SMTP id pf8mr1507635lbb.20.1446037402054;
        Wed, 28 Oct 2015 06:03:22 -0700 (PDT)
X-Received: by 10.140.102.45 with SMTP id v42mr814933qge.9.1446037401436; Wed,
 28 Oct 2015 06:03:21 -0700 (PDT)
Path: ...!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!proxad.net!feeder1-2.proxad.net!209.85.217.216.MISMATCH!wb3no5969421lbb.1!news-out.google.com!t36ni33236qge.1!nntp.google.com!m48no3027644qgd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 28 Oct 2015 06:03:21 -0700 (PDT)
In-Reply-To: <e52faa9c-f064-4f25-a680-7957301e8c0b@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=141.58.122.8; posting-account=glPZ8goAAADztwA3kVEZPMKXCGydx5DU
NNTP-Posting-Host: 141.58.122.8
References: <e52faa9c-f064-4f25-a680-7957301e8c0b@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2e53a960-68a4-4e3c-b667-00ce364f9344@googlegroups.com>
Subject: Re: Bind <Leave> to Menu does not work
From: Alexandru <alexandru.dadalau@meshparts.de>
Injection-Date: Wed, 28 Oct 2015 13:03:21 +0000
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Am Mittwoch, 16. September 2015 00:44:49 UTC+2 schrieb Alexandru:
> Hi,
>=20
> any idea why binding the <Leave> event to a menu does not work?
>=20
> menu .popupmenu -tearoff 0
> bind .popupmenu <Leave> "puts *****"
> .popupmenu add command -label test
> tk_popup .popupmenu 100 100 0
>=20
> Thanks!

Hi,

I have to come back with the same problem.=20

Does anybody have an idea, how to react to menu unpost and know if the user=
 really clicked before that on a menu entry or not?

I have this nice test script, with an very interesting behavior. Execute th=
e script and right click on the label. A popup menu will appear. Now either=
 left click in the menu or press the Escape key. When the user click in the=
 menu, a message is displayed. When the menu is unposted, another message i=
s displayed. There is a control variable "action" that should store what us=
er did, but this does not work right:

variable action ""

proc aftermenuclick {} {
	variable action "Click"
	tk_messageBox -message "This command is executed ONLY if user clicks in th=
e menu \nand AFTER the menu is unposted."
}
proc popup {w x y} {
	set wex [winfo rootx $w]
	set wey [winfo rooty $w]
	set x [expr {$x+$wex}]
	set y [expr {$y+$wey}]

	destroy .popupmenu
	menu .popupmenu -tearoff 0
	.popupmenu add command -label "Click here OR press Esc key" -command after=
menuclick
	tk_popup .popupmenu $x $y 0

	variable action
	if {$action=3D=3D""} {
		set action "Escape"
	}
	tk_messageBox -message  "Now I know the menu is unposted - but I don't kno=
w if user clicked in the menu or pressed Esc key. $action"
	set action ""
}

destroy .fr
pack [ttk::frame .fr]
pack [ttk::label .fr.l -text "Right click here to show the popup menu"]
bind .fr.l <3> {popup %W %x %y}

My system is Win 7 64 Bit. I know that the menu is managed by the OS but I =
really need to find a hack for this problem.

Many thanks!
Alexandru