in reply to Re: Deleting Menu Item from Menu
in thread Deleting Menu Item from Menu

.. just lops off the first entry, and dosn't remove an entry by name( actually modifying the underlying AoA is still shrouded in mystery)
To reveal some, try $Btn1->[0]->delete(); errors
Tk::Error: wrong # args: should be ".menu.main.insert delete first ?la +st?" at D:/Perl/site/lib/Tk.pm line 247. Tk callback for .menu.main.insert (menu invoke)
Curious. To look up the name you need
$Btn1->parentMenu->delete($Btn1->parentMenu->index($Btn1->[1])); # or $Btn1->[0]->delete($Btn1->[0]->index($Btn1->[1])); # or $$Btn1[0]->delete($$Btn1[0]->index($$Btn1[1])); # or $insert->menu->delete($insert->menu->index($$Btn1[1]));
Yucky :)

Replies are listed 'Best First'.
Re^3: Deleting Menu Item from Menu
by zentara (Cardinal) on Jan 28, 2009 at 19:27 UTC
    Here is a way to add to the menu
    sub add_menu{ # must be cascade, checkbutton, command, radiobutton, or separator $Btn1->parentMenu->add('command',-label => time, -command=>sub{print "3\n";}); }

    I'm not really a human, but I play one on earth Remember How Lucky You Are
Re^3: Deleting Menu Item from Menu
by zentara (Cardinal) on Jan 28, 2009 at 16:15 UTC
    Thanks for that insight, every bit helps. It would be sweet to have a menuing system that used a tied AoH ( or similar) to build the menu, then have it automatically adjust to changes in the tied structure.

    I'm not really a human, but I play one on earth Remember How Lucky You Are