I'm writing a simple GUI Perl Tk converter of corrupt Open Office files into salvaged text and an attempt at a recovered version of the files. I have a Tk text area which displays the text and a menu bar that shows a button which when pushed launches the attempts at a recovered version of the file using whatever program is set to open the Open Office file format in question.

These all work fine. The problem is, after the first file recovery, with all subsequent files opened, the menubuttons keep piling up, and I can't erase the old ones. The menu buttons all try to launch the newest recovered file when pushed, not even pointing to the previous files recovered. I have tried to use "unpost", "destroy" and "forget" combined with "pack" with all sorts of arrows and double arrow with no luck. Of course I have no idea what I'm doing but the fun part is over now and frustration is seeping in.

I'm just a hacker newbie, and I'm not even sure if the button is a Tk::Menubutton or a Tk::Menu::Button as I have both modules referenced in the beginning, from borrowing from other scripts I hacked out before.

Anyway here is my button code which is part of the "Main Loop"/"sub menuopenClicked" section of my script which is launched when a user chooses a file from the Open choice on the simple File menu:

$but = $mbar -> Button(-label=>"Launch $ruslcbasename", -command =>\&recovered);


In reply to Can't Erase Previous Menu Button by socrtwo

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.