[Gambas-user] New treeview is getting a little bit overexcited

Bruce bbruen at ...2308...
Sun Nov 4 23:33:48 CET 2012


On Sun, 2012-11-04 at 14:35 +0100, Benoît Minisini wrote:
> Le 04/11/2012 11:54, Bruce a écrit :
> > This used to work
> >          tvwJockeys.Add(Subst("R&1#&2", cs.RaceNo, cs.BP),
> >          Subst("(R&2 ... #&3) &1", cs.HorseName, cs.RaceNo, cs.TabNo),,
> >          cs.Jockey)
> >
> > OK, I'll simplify :-)
> >
> >          tvwX.Add(somekey, sometext,,parent)
> >
> > no Picture, no After.
> >
> > Now I get a "null object" error.  I think its due to the empty parameter
> > [Optional Picture as Picture]?  ... because every other cs.something is
> > valid.
> >
>  > ...
>  >
> 
> tvwX.Add(somekey, sometext,,parent)
> 
> is perfectly valid.
> 
> So you must give me more information about where you get a null error. 
> Ensure that cs is not null before calling tvwJockeys.Add(), to find what 
> is null exactly.
> 
> Regards,
> 

Hi Benoît,

After a bit of tracking it down, the null object is at line 109 in 
_Treeview:


Public Sub _SortParent(sKey As String)
  
  If sKey Then
    $cSort[sKey] = True                   <-------!!!!
  Else
    $bSortRoot = True
  Endif
  If Not $hSortTimer Then
    $hSortTimer = New Timer As "Sort"
    $hSortTimer.Trigger
  Endif
  
End

The null object is $cSort.  

The problem arises on the second time the treeview is loaded, not the
first.

I hacked the FTreeview class a bit in gb.gui.base to demonstrate. It is
attached.

Basically, I added a "Refresh" button that clears and reloads the tree
(and there are a few debug messages still hanging around in it).

When the program starts, the treeview is loaded properly, but when the
Refresh button is clicked the null object occurs.

regards
Bruce





-------------- next part --------------
A non-text attachment was scrubbed...
Name: gb.gui.base-3.3.90.tar.gz
Type: application/x-compressed-tar
Size: 111126 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20121105/29c8e14a/attachment.bin>


More information about the User mailing list