Menu

#3065 menus can't post if application is not in foreground

current: 8.6.0
open
5
2013-03-25
2013-02-07
Anonymous
No

A popup menu causes an error if you try to post it while another application is in the foreground.

test code:
menu .pm
.pm add command -label test
bind . <Button-2> "tk_popup .pm %X %Y"

works fine if Wish is in the foreground.
If you click on any other application, then right-click on the Wish window (while leaving it in the background) an error is thrown on the .pm post command.

Discussion

  • Kevin Walzer

    Kevin Walzer - 2013-03-24
    • assigned_to: das --> wordtech
    • status: open --> open-wont-fix
     
  • Kevin Walzer

    Kevin Walzer - 2013-03-24

    Looking at the implementation in tkMacOSXMenu.c, it appears that the popup menu requires a window reference that can only be obtained via [NSApp keyWindow]--c.f. a window with focus. I don't see another way to do it in Tk.

     
  • Kevin Walzer

    Kevin Walzer - 2013-03-24
    • status: open-wont-fix --> closed-wont-fix
     
  • Donal K. Fellows

    But arguably we ought to be more graceful about this failure case. Even if it can't work, it shouldn't throw an error in the user's face. Suggest trapping (just) this particular error in [tk_popup]…

     
  • Kevin Walzer

    Kevin Walzer - 2013-03-25
    • status: closed-wont-fix --> open
     
  • Kevin Walzer

    Kevin Walzer - 2013-03-25

    That's a sensible suggestion--I'll take a look at implementing this.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.