Hello!

When running the example below I get the error:

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

#!/usr/bin/perl -w use strict; use Tk; use Tk::Pane; use Tk::HList; sub door { my $house = shift; my $door_W = $house->Toplevel(); my $hlist = $door_W->Scrolled( 'HList', -scrollbars => "se", -columns => 1, -header => 1, )->pack( -expand => 1, -fill => 'both'); $hlist->headerCreate(0, -text => 'Title'); $hlist->columnWidth(0, ''); $hlist->bind("<Button-1>" => [\&knock_on_door, $door_W]); my $exit_B = $door_W->Button( -text => 'Exit', -command => sub { $door_W->destroy(); }, -relief => 'raised', )->pack(-side => 'left'); } sub knock_on_door { my $frame = shift; my $pop_menu = $frame->Menu( -menuitems => [ ['command', 'Knock on door.', -command => sub { print "Knock! Knock!!!\n"; } ], '', ] )->Popup(-popover => "cursor", -popanchor => 'nw'); $pop_menu->destroy; } my $mw = MainWindow->new; $mw->Button(-text => "Close", -command =>sub{exit})->pack(); door($mw); MainLoop;

You receive the error after selecting "knock on door" and pushing the Exit button.
You don't recieve the error if you only push the Exit button.
I am running TK 804.032

Thankful for any ideas.

Thomas


In reply to Why does widget->destroy give the error Tk::Error widget was deleted before its visibility changed? by thomas.bystrom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.