It is currently Fri Aug 23, 2019 12:12 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Wrong value for CountGadgetItems at Treegadget
PostPosted: Wed Aug 14, 2019 11:25 pm 
Offline
New User
New User

Joined: Sat Jun 21, 2003 12:11 pm
Posts: 6
Example
Code:
If OpenWindow(0, 216, 0, 290, 530, "",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered) 
  TreeGadget(1, 30, 30, 230, 380)
  AddGadgetItem(1,-1,"2010",0,0)
  AddGadgetItem(1,-1,"2011",0,0)
  AddGadgetItem(1,-1,"2012",0,2)
  AddGadgetItem(1,-1,"2013",0,0)
  AddGadgetItem(1,-1,"2014",0,2)
  AddGadgetItem(1,-1,"2015",0,2)
  AddGadgetItem(1,-1,"2016",0,2) 
  Debug CountGadgetItems (1)
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
End


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong value for CountGadgetItems at Treegadget
PostPosted: Sun Aug 18, 2019 3:57 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1643
Location: Germany
I can't confirm your finding! I have tested your example on these operating systems and all report 7, which is the correct count of entries in the TreeGadget:
- MacOS 10.6.8 'Snow Leopard' with PB 5.46 x86 and PB 5.62 in ASCII and Unicode mode
- MacOS 10.14.6 'Mojave' with PB 5.70 x64
- Linux Mint 19.2 'Tina' x64 with Cinnamon and PB 5.71 x64
- Windows 10 x64 V1809 with PB 5.70 x86

By the way, your code contains an error: in AddGadgetItem() you specify a node level of 2 before having specified a node level of 1. On MacOS (not on Linux and Windows!) you therefore obtain the following output (being unable to expand the nodes):
2010
2011
2013

After replacing value 2 with 1 in AddGadgetItem() and opening the parent nodes the correct output is displayed:
2010
2011
- 2012
2013
- 2014
- 2015
- 2016

Nevertheless in both cases the output of CountGadgetItems() is correct: 7


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong value for CountGadgetItems at Treegadget
PostPosted: Mon Aug 19, 2019 8:28 am 
Offline
New User
New User

Joined: Sat Jun 21, 2003 12:11 pm
Posts: 6
The error in MacOS is that the value of CountGadgetItems does not match the number of items in the TreeGadget.

I have deliberately specified level 2 as this will cause the error. If you specify a wrong level, PureBasic should either report an error, correct the error (as in Windows) on its own or not create the entries.

But in any case the value of CountGadgetItems must correspond to the number of entries in the TreeGadget.


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong value for CountGadgetItems at Treegadget
PostPosted: Mon Aug 19, 2019 10:16 am 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1643
Location: Germany
Which version of MacOS are you using and which version of PureBasic? And which value does CountGadgetItems() display with your example from your first posting?

As I have written for Snow Leopard and Mojave, although the output with node level 2 is incorrect, the result returned from CountGadgetItems() is 7 and therefore correct.

IB-Software wrote:
If you specify a wrong level, PureBasic should either report an error, correct the error (as in Windows) on its own or not create the entries.
I agree.


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong value for CountGadgetItems at Treegadget
PostPosted: Tue Aug 20, 2019 7:19 am 
Offline
New User
New User

Joined: Sat Jun 21, 2003 12:11 pm
Posts: 6
I tested with MacOS Mojave and PureBasis 5.70. 3 entries are displayed:

2010
2011
2013

But CountGadgetItems returns 7. This is wrong because only three items are displayed.


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong value for CountGadgetItems at Treegadget
PostPosted: Tue Aug 20, 2019 7:32 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 13, 2010 3:45 pm
Posts: 882
IB-Software wrote:
But CountGadgetItems returns 7. This is wrong because only three items are displayed.

What is so hard to understand about the function name CountGadgetItems()? This function does exactly what the name says, it returns how many items the Gadget has.

Again a typical example. Don't know anything, but post in the bugs immediately. Please can a mod move this drama to the garbage?

_________________
sorry for my bad english


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong value for CountGadgetItems at Treegadget
PostPosted: Tue Aug 20, 2019 1:00 pm 
Offline
New User
New User

Joined: Sat Jun 21, 2003 12:11 pm
Posts: 6
Ok, even if the CountGadgetItems function returns the correct value, based on the AddGadgetItem function, although the TreeGadget displays a different number of entries, then the different handling of the "wrong" levels in MacOS and Windows is a bug in any case.


Top
 Profile  
Reply with quote  
 Post subject: Re: Wrong value for CountGadgetItems at Treegadget
PostPosted: Tue Aug 20, 2019 5:59 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Oct 09, 2007 2:15 am
Posts: 1078
IB-Software wrote:
Ok, even if the CountGadgetItems function returns the correct value, based on the AddGadgetItem function, although the TreeGadget displays a different number of entries, then the different handling of the "wrong" levels in MacOS and Windows is a bug in any case.


This is not a bug, if you "forget" one stage. You go from 0 to 2... there is a little 1 between them....

_________________
PureBasic 5.70 LTS (Windows x86/x64) | Windows10 Pro x64 | Z370 Extreme4 | i7 8770k | 32GB RAM | iChill GeForce GTX 980 X4 Ultra | HAF XF Evo​​
English is not my native language... (I often use DeepL to translate my texts.)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye