Restored from previous forum. Originally posted by El_Choni.
That's it. Sometimes you don't know how many Gadgets are you going to need (for example, in an MDI app). And using it with a big number maybe uses a big and fixed amount of memory (haven't tested that XD).
Please?
Thanks. Bye,
El_Choni
[Implemented] Remove InitGadget()
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
you dont need InitGadget() for your own MDI stuff (a lib?),
but for the PureBasic internals atm.
1 way could be (in the .lib):
1 dword with Current Gadget count, initialized with 0 at the beginning
10 words memory reserved for 10 Gadgets initially
1 procedure for gadget creation (every gadget-creation command call this)
The procedure checks "Current Gadget Count"
If CurrentGadgetCount is higher than requested Gadget number
allocate some more memory for gadget handles (PB internal)
Endif
So the Gadget count is done automatically, and memory
allocated automatically as needed.
No InitGadget() needed anymore...
cya,
...Danilo
(registered PureBasic user)
you dont need InitGadget() for your own MDI stuff (a lib?),
but for the PureBasic internals atm.
1 way could be (in the .lib):
1 dword with Current Gadget count, initialized with 0 at the beginning
10 words memory reserved for 10 Gadgets initially
1 procedure for gadget creation (every gadget-creation command call this)
The procedure checks "Current Gadget Count"
If CurrentGadgetCount is higher than requested Gadget number
allocate some more memory for gadget handles (PB internal)
Endif
So the Gadget count is done automatically, and memory
allocated automatically as needed.
No InitGadget() needed anymore...
cya,
...Danilo
(registered PureBasic user)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
In earlier versions it was possible to call InitGadget more than once. (to increase the max number)
I did it!
But since 2v8 (if I recall it right...) it was gone.
And it seems, that Fred put the old way back!
Since 3v0 you can do it again!
So if your max number is to small call InitGadget again and increase the max number.
Thanks Fred this is cool.
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 11 April 2002 20:44:05
In earlier versions it was possible to call InitGadget more than once. (to increase the max number)
I did it!
But since 2v8 (if I recall it right...) it was gone.
And it seems, that Fred put the old way back!
Since 3v0 you can do it again!
So if your max number is to small call InitGadget again and increase the max number.
Thanks Fred this is cool.
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 11 April 2002 20:44:05
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Looking forward to it
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
OK I will use the InitXXXX Commands only once now till...Whooooow ! Stop.
...this takes places.Probably is command will be removed with 3.10 as all other commands (InitWindow(), InitMenu() etc...). Wait'n'see.
Looking forward to it
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
Danilo: it's not for a lib, but for an app (I've decided not to call PB functions from a lib, I think it's risky). Anyway, I don't get your point. I mean, I understand what you say if I'm creating my own gadgets (controls) from a lib, and it's more or less the way I do it (not really, I allocate memory for 8192 controls and not care any more), but what if I use PB gadgets? In this case, I want to use the Image gadget. API way to do it is giving me headaches.
Ok, so I'll wait for PB 3.1 to do things the right way.
Thanks,
El_Choni
Danilo: it's not for a lib, but for an app (I've decided not to call PB functions from a lib, I think it's risky). Anyway, I don't get your point. I mean, I understand what you say if I'm creating my own gadgets (controls) from a lib, and it's more or less the way I do it (not really, I allocate memory for 8192 controls and not care any more), but what if I use PB gadgets? In this case, I want to use the Image gadget. API way to do it is giving me headaches.
Since 3v0 you can do it again!
So if your max number is to small call InitGadget again and increase the max number.
Thanks Fred this is cool.
This must be then a true "hidden feature" (hidden even to the programmer)Whooooow ! Stop. All InitXXX() Commands MUST be called ONLY ONCE !
Ok, so I'll wait for PB 3.1 to do things the right way.
Thanks,
El_Choni
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by SimpleMind.
Hi,
Is it possible to put the Gadgets in LinkedLists constructions, in a way to create Gadgets on the fly and hook (and initialize) them in a list. It's just an Idea.
SimpleMind,
KISS (keep it simple and smart). Don't forget to laugh.
- Registered PureBasic Coder. -
Hi,
Is it possible to put the Gadgets in LinkedLists constructions, in a way to create Gadgets on the fly and hook (and initialize) them in a list. It's just an Idea.
SimpleMind,
KISS (keep it simple and smart). Don't forget to laugh.
- Registered PureBasic Coder. -