Here is a start on a editable Tree with Tk::Tree. I just hardcode 'foobar' in on a right click, but you would want to pop a small dialogbox with an entry, get the new text, then change the text.
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Tree; my($icon)=<<'END'; /* XPM */ static char * junk_xpm[] = { "10 10 6 1", " c #000000", ". c #FFFFFF", "X c #B129F8", "o c #F869A6", "O c #00FF00", "+ c #1429F8", " X..oo.+. ", " .X....+. ", " ..X...+. ", " o..X.... ", " oo..X... ", " .oo..X.. ", " ......X. ", " .+.....X ", " .+..oo.. ", " .+...oo. "}; END my $mw = MainWindow->new(-title=> 'Tree'); my $tree = $mw->Scrolled('Tree',-header=>'1',-scrollbars=>'osoe',- itemtype=>'imagetext',-separator => '|')->pack +; $tree->add('hi',-text=>"hi",-bitmap=>'questhead'); $tree->indicatorCreate('hi'); $tree->setmode('hi','close'); $tree->add('hi|there',-text=>"hi there",-image=>$mw->Pixmap(-data=>$ic +on)); $tree->indicatorCreate('hi|there'); $tree->setmode('hi|there','close'); $tree->add('hi|there|a',-text=>"hi there",-image=>$mw->Pixmap(-data=>$ +icon)); $tree->indicatorCreate('hi|there|a'); $tree->setmode('hi|there|a','close'); $tree->add('hi|there|a|c',-text=>"hi there",-image=>$mw->Pixmap(-data= +>$icon)); $tree->add('hi|there|b',-text=>"hi there",-image=>$mw->Pixmap(-data=>$ +icon)); $tree->bind("<Button-3>" => \&show_pos); MainLoop; sub show_pos { my ($x, $y) = $mw->pointerxy; print "$x $y\t"; my $s = $tree->nearest($y - $tree->rooty); print "$s\n"; $tree->selectionClear(); $tree->selectionSet($s); #pop a dialogbox here and get new text $tree->itemConfigure($s,0,-text=>'foobar'); }

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

In reply to Re: Editable tree in Tk by zentara
in thread Editable tree in Tk by anna_black

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.