Restored from previous forum. Originally posted by tranquil.
Hi all!
First Idea:
------------
Why do PureBasic use Numbers instead of Handles? Would this not be better?
That is what I mean:
openwindow(NR,x,y,....)
becomes only openwindow(x,y,....) and returns a unique number for it.
That for all, for Gadgets, Sprites, Sounds, Memory etc. etc.
That would made life much easier couse you dont have to think about which nummber is still in use and which not. That is a real problem in huge source-codes.
Another Idea:
-------------
Using the Network as a File.
OpenNetworkConnection returns the ID of the connection. It would be nice now to use the File-Commands like:
writebyte, writelong, writestring etc. etc.
same for readbyte, readstring etc. etc.
Only an Idea to save some Commands.
Comments?
Cheers
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
Why not using Handles then Numbers?
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
PrintN(OpenWindow(...))
PrintN(WindowID())
But using numbers can be easier for beginners, rather than them having to think about handles.
One area which I would agree with you on this is memory allocation. It is fine to be able to give each memory allocation a bank number, but there should also be a command to allocate memory without using a bank number.
An example of this would be if I am writing my own linked list code (for example, I want to put a linked list into a Structure). PB can not do this automatically, like with arrays, so you need to code the memory allocations yourself. Or if you want to get low level access to the list items easily. In these cases you do not want to have to keep track of which memory banks have and have not been used, you just want some memory.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.10)
It does that already (I think). Try it, just do something like:Why do PureBasic use Numbers instead of Handles? Would this not be better?
That is what I mean:
openwindow(NR,x,y,....)
becomes only openwindow(x,y,....) and returns a unique number for it.
That for all, for Gadgets, Sprites, Sounds, Memory etc. etc.
PrintN(OpenWindow(...))
PrintN(WindowID())
But using numbers can be easier for beginners, rather than them having to think about handles.
One area which I would agree with you on this is memory allocation. It is fine to be able to give each memory allocation a bank number, but there should also be a command to allocate memory without using a bank number.
An example of this would be if I am writing my own linked list code (for example, I want to put a linked list into a Structure). PB can not do this automatically, like with arrays, so you need to code the memory allocations yourself. Or if you want to get low level access to the list items easily. In these cases you do not want to have to keep track of which memory banks have and have not been used, you just want some memory.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.10)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> openwindow(NR,x,y,....)
> becomes only openwindow(x,y,....) and returns a unique number for it.
> That for all, for Gadgets, Sprites, Sounds, Memory etc. etc.
You can already do that. For a window, just use: handle=OpenWindow(number,x,y,...).
For gadgets, just use: handle=ButtonGadget(number,x,y,...).
That is, just give each item any number you want (as long as they don't clash),
and then refer to the item by its allocated handle later. However, this means
many commands (such as GadgetVisible) won't work, and you'll need to use the
API instead, such as ShowWindow_(handle,state) instead of GadgetVisible.
PB - Registered PureBasic Coder
Edited by - PB on 31 May 2002 17:39:52
> openwindow(NR,x,y,....)
> becomes only openwindow(x,y,....) and returns a unique number for it.
> That for all, for Gadgets, Sprites, Sounds, Memory etc. etc.
You can already do that. For a window, just use: handle=OpenWindow(number,x,y,...).
For gadgets, just use: handle=ButtonGadget(number,x,y,...).
That is, just give each item any number you want (as long as they don't clash),
and then refer to the item by its allocated handle later. However, this means
many commands (such as GadgetVisible) won't work, and you'll need to use the
API instead, such as ShowWindow_(handle,state) instead of GadgetVisible.
PB - Registered PureBasic Coder
Edited by - PB on 31 May 2002 17:39:52
-
- 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.
Since PureBasic v3.10 there is a GadgetID(Gadget#) command.
If you need a handle:
MyHandle=GadgetID(Your_gadget_Number)
Or use PureGUI.
It will come this weekend, despite of the beautiful weather on the WestCoast.
The code is finished. I'm working on the documentation. You will get the full source code.
Stay tuned...
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Since PureBasic v3.10 there is a GadgetID(Gadget#) command.
If you need a handle:
MyHandle=GadgetID(Your_gadget_Number)
...the wrack is the damn number I have to choose for every object. Making this number optional will be best!
Or use PureGUI.
It will come this weekend, despite of the beautiful weather on the WestCoast.
The code is finished. I'm working on the documentation. You will get the full source code.
Stay tuned...
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Hi all,
PureGUI is released!
http://fsw.home.attbi.com
under section PureGUI you will find 'Download'.
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Hi all,
PureGUI is released!
http://fsw.home.attbi.com
under section PureGUI you will find 'Download'.
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.