From: Mattia B. <mb...@ds...> - 2002-09-01 19:36:26
|
> On Mon, 26 Aug 2002, Mattia Barbon wrote: > > This is maily for Marcus, but might interest others. > > There are two ways to workaround the bug you reported > > (I suddenly realized that I did not explain the workaround, sorry) > > 1 - Call directly ->InsertItemPrev (if the 2nd argument is a > > Wx::TreeItemId) or ->InsertItemBef (if the 2nd argument is an > > integer) > > 2 - do this, after the "use Wx;" > > undef *Wx::TreeCtrl::InsertItem; > > *Wx::TreeCtrl::InsertItem = sub { > > my $this = shift; > > > > if( ref( $_[1] ) && $_[1]->isa( 'Wx::TreeItemId' ) ) > > { return $this->InsertItemPrev( @_ ) } > > return $this->InsertItemBef( @_ ); > > } > > Hi, I don't remember seeing the oringal bug report, It was sent by private mail. > but I found a problem with InsertItem yesterday too > and I think the problem you give above must be the same one. Yes. > I had this patch, but perhaps it's irrelevant: Already applied to CVS. Thanks anyway. > --- TreeCtrl.pm.orig Thu May 2 16:28:28 2002 > +++ TreeCtrl.pm Thu Aug 29 18:33:36 2002 > @@ -29,7 +29,7 @@ > sub InsertItem { > my $this = shift; > > - if( isa( $_[1], 'Wx::TreeItemId' ) ) { return $this->InsertItemPrev( @_ ) } > + if( UNIVERSAL::isa( $_[1], 'Wx::TreeItemId' ) ) { return $this->InsertItemPrev( @_ ) } > return $this->InsertItemBef( @_ ); > } > > It simply calls `isa' in the correct (UNIVERSAL) package. > Also, I wished to not hack wxPerl (or allow > that possibly someone already installed an > earlier version), so I used this in my application: > > BEGIN { *Wx::TreeCtrl::isa = *UNIVERSAL::isa } > > It aliases the bogus `isa' in TreeCtrl package > to be in the UNIVERSAL package instead. :) Yhis looks like a much nicer workaround. Thanks! Mattia |