in reply to Re^2: Why does widget->destroy give the error Tk::Error widget was deleted before its visibility changed?
in thread Why does widget->destroy give the error Tk::Error widget was deleted before its visibility changed?

I am facing the same problem in several places in my application where I am using a menu bound to an hlist.

I do not understand the proposed solution and how scoping plays a part

In my application I am assigning the menu object to a hash element so that I can refer to it and try to destroy it when the window is going to close. like this:

$winInfoRef->{MENU}= $winInfoRef->{HLIST}->Menu(-tearoff=>1,

I have recreated the problem with the originally posted example code, I changed the lines to make $pop_menu a global as suggested (and relisted below)

#~ my $pop_menu = $frame->Menu( -menuitems => our $pop_menu ; $pop_menu ||= $frame->Menu( -menuitems =>

but I still get the same error:

Tk::Error: window ".toplevel.frame.hlist.menu" was deleted before its +visibility changed at C:/Perl/site/lib/Tk/Widget.pm line 1000. Tk callback for tkwait <Button-1> (command bound to event)

Thomas said he withdrew his menu, but I tried that too with no success(maybe I don't know how) Can anyone share more insight into this error?

  • Comment on Re^3: Why does widget->destroy give the error Tk::Error widget was deleted before its visibility changed?
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: Why does widget->destroy give the error Tk::Error widget was deleted before its visibility changed?
by Anonymous Monk on Jun 12, 2017 at 04:54 UTC
    to Tk-804.033, then you don't have to learn anything
      perl -v v5.22.2 (32 bit)
      perl -MTk -e "print $Tk::VERSION" shows 804.033

      Were you implying that this version should have fixed a problem with destroying the popup menu?

      Thanks!
        I was mistaken so ignore me