Maximum number of gadgets

Just starting out? Need help? Post your questions and find answers here.
neuronic
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Apr 26, 2003 11:38 pm
Contact:

Maximum number of gadgets

Post by neuronic »

Hi

I am working on a small application and I would like to use lots of gadgets. Is there any way I can use more gadgets then 10.000? If i create a lot I get the message: #Gadget object number is very high (over 10.000).

Any ideas?????

Neuronic
Phoenix
Enthusiast
Enthusiast
Posts: 141
Joined: Sun Sep 04, 2005 2:25 am

Re: Maximum number of gadgets

Post by Phoenix »

How can a small application have more than 10000 gadgets????
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

I believe that is only a warning from the debugger you can still continue execution.

I'm not sure but i think the real limit is 65000
~Dreglor
oldBear
Enthusiast
Enthusiast
Posts: 121
Joined: Tue Jul 05, 2005 2:42 pm
Location: berrypatch

Re: Maximum number of gadgets

Post by oldBear »

Phoenix wrote:How can a small application have more than 10000 gadgets????
He probably doesn't. He's may be referrring to a gadget by an improper id for the gadget in question.

I thought the message was 100,000 not 10,000 but my references to it may have been something other than on a gadget.

cheers
Jan Vooijs
Enthusiast
Enthusiast
Posts: 196
Joined: Tue Sep 30, 2003 4:32 pm
Location: The Netherlands

Post by Jan Vooijs »

For files it is a 1000, had that exception yesterday try-ing to open a file with the number 1005, so why not for gadgets?

Jan V.
Life goes to Fast, Enjoy!!

PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!

AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
neuronic
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Apr 26, 2003 11:38 pm
Contact:

Post by neuronic »

Hi again

I would really like to have that many gadgets. It is not a wrong id number or anything similar. The application is a simple map editor, where i need ImageGadgets depending on the size of the map.

If I turn the debugger off the execution goes on, but there are no more gadgets created.

Off course I can use a different method, where i don't need thousands of gadgets, but using this is the easiest way.

Bye
Neuronic
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Without #PB_Any you can create only 10000 Gadgets.
Use #PB_Any, you can create Gadgets with max from OS
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

I almost replied with ts-soft's answer, as I believed it to work like that. It does work like that with windows as opposed to gadgets. But I ran a little test and it seems like there is an upper limit of 9999 for gadgets:

Code: Select all

Dim gadgets(100000)
OpenWindow(0,0,0,800,600,"")
CreateGadgetList(WindowID(0))
CreateImage(0,1,1)
gadgetcount = 1
gadgets(gadgetcount) = ImageGadget(#PB_Any, Random(799),Random(599),1,1,ImageID(0))
While IsGadget(gadgets(gadgetcount)) <> 0
  gadgetcount+1
  gadgets(gadgetcount) = ImageGadget(#PB_Any, Random(799),Random(599),1,1,ImageID(0))
Wend
Debug "Number of gadgets created: "+Str(gadgetcount)
Repeat:Until WaitWindowEvent()=#WM_CLOSE
See what result you get, but I can't ever get more than 9999 successful gadget creations.
BERESHEIT
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

You can Create Gadget from 0 to 9999 and Window from 0 to 4999 with
Constants! More only with #PB_Any
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Demivec
Addict
Addict
Posts: 4270
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post by Demivec »

netmaestro wrote:See what result you get, but I can't ever get more than 9999 successful gadget creations.
I modified your sample code to create 9000 gadgets with constants 1-9000 and then create as many additional ones as were possible with #PB_Any. I still only came to 9999 total. So it seems that combinations of constant numbering and #PB_Any doesn't seem to increase the total possible.


Demivec
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

I would say If u have 10000 Gadgets ure program will be so slow that u want to look for anoothert possiblility. In U#re case i would use an openscreen (also faster)
Apart from that Mrs Lincoln, how was the show?
Fred
Administrator
Administrator
Posts: 18253
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It's probably a Windows limitation, as each control is an handle and 10 000 handle for only one application is way too much. Somebody can do a loop of CreateWindowEx() to see if it's reproducible with API only ?

BTW, the debugger warning about the maximum reached is just a warning, it doesn't prevent the creation.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Good idea, Fred:

Code: Select all

hwnd=OpenWindow(0,0,0,320,240,"")
Repeat
  MyText=CreateWindowEx_(#WS_EX_LEFT,"Static","",#WS_CHILD|#SS_CENTER,0,100,200,20,hwnd,0,GetModuleHandle_(0),0) 
  cc+1
Until mytext=0
Debug cc
This code is debugging 9999 here. I vote for Windows limitation :wink:

[edit] The max# of open windows seems to be 10000, as if I remove the OpenWindow() from the above snip and take out the #WS_CHILD style, it dies at 10000 instead of 9999.
BERESHEIT
Post Reply