Re: Cut and paste on HList::Tree
by Marc Dashevsky other posts by this author
Mar 30 2007 12:45PM messages near this date
Cut and paste on HList::Tree
|
Re: Cut and paste on HList::Tree
SOURCE At 11:39 AM 3/30/2007, you wrote:
> Hi,
>
> I'm trying to implement cut and paste functionality on a Tree widget, basically when the us
er selects one entry and right-click a menu shows up with the options Cut, Copy, Paste befor
e, Paste after. Cut and copy work fine, paste works when the new entry is inserted at the en
d of the tree but the program crashes when I use options -at, -before and -after.
> Any help will be greatly appreciated.
>
> Thanks
> Patricia
>
> This is the part of my script that crashes
> $menu = $db->Menu(
> -tearoff => 0,
> -menuitems =>[
> ['command'=>'Paste Before',
> -command => sub{
> print "Paste Before \n";
> $parent = $tests_list->infoParent($index[0]);
> # This works $tests_list->addchild($parent, -text => $item_sel);
> # Next 2 crash
> $tests_list->add($parent,-before =>$index[0], -text => $item_sel);
> $tests_list->add($parent,-at=>1, text=>$item_sel
> }
> ],
It's a known bug. Move -at and -before options to the end of the list to work around, i.e.:
$tests_list-> add($parent, -text => $item_sel, -before => $index[0]);
$tests_list-> add($parent, -text => $item_sel, -at => 1);
Marc
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
ptk@[...].edu
https://mailman.stanford.edu/mailman/listinfo/ptk
Thread:
Pat R
Marc Dashevsky
Slaven Rezic
|