Restored from previous forum. Originally posted by banban.
Here is my problem :
I try to write a program in order to calculate dimensions for laminate-wood beams.
I need to open a second window with gadgets inside from a first window which has his own gagdets.
If I try to attach a gadgetlist to the second window with gadget numbers starting from 0, I can't get the first window gadget working when I come back to this.
It seems PureBasic acts like there's only one gadgetlist and attach parts of it to the different windows.
The only way I found till there is to have different gadget numbers in the two windows. Is there a bug here or somethnig I forgot.
Multiple GadgetLists
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
"Wrong. Each gadget actually display (or created) must have an unique ID. How will you make the difference between the two 0 gadgets else?"
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.20)
viewtopic.php?t=1479, that is what you have to do:The only way I found till there is to have different gadget numbers in the two windows. Is there a bug here or somethnig I forgot.
"Wrong. Each gadget actually display (or created) must have an unique ID. How will you make the difference between the two 0 gadgets else?"
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.20)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Hi Banban,
welcome to the PureBasic community.
If you have one window or more it is always ONE APPLICATION and ONE EVENT HANDLER.
Technically you can have the same numbers for the gadgets on different windows PureBasic can handle this. The question is if you can handle it, because you have to split your Event Handler (event loop) for the different Windows. (for more information look at this viewtopic.php?t=1479 )
And this gets more complicated the more windows you have.
Conclusion: this is a very, very bad choice.
That's why Fred said what Tinman told you above.
It makes no sense to use the same numbers for different Windows.
The only thing you will earn is more work and more problems to get all things straight (without bugs).
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 17 June 2002 17:35:35
Hi Banban,
welcome to the PureBasic community.
If you have one window or more it is always ONE APPLICATION and ONE EVENT HANDLER.
Technically you can have the same numbers for the gadgets on different windows PureBasic can handle this. The question is if you can handle it, because you have to split your Event Handler (event loop) for the different Windows. (for more information look at this viewtopic.php?t=1479 )
And this gets more complicated the more windows you have.
Conclusion: this is a very, very bad choice.
That's why Fred said what Tinman told you above.
It makes no sense to use the same numbers for different Windows.
The only thing you will earn is more work and more problems to get all things straight (without bugs).
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 17 June 2002 17:35:35
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by banban.
Hi,
I guess my question was in his right place in 'beginners' forum.
I was lame coding on Amiga with Blitz Basic in which, as far as I remeber, each window handles its own gadgetlist and events. *
Maybe my code is not structured enough
!
No way, thank You very much for your quick answers.
Bye Bye
Banban
Hi,
I guess my question was in his right place in 'beginners' forum.
I was lame coding on Amiga with Blitz Basic in which, as far as I remeber, each window handles its own gadgetlist and events. *
Maybe my code is not structured enough
No way, thank You very much for your quick answers.
Bye Bye
Banban
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.

I don't see why you'd have one huge event loop, especially if you want to keep the code modular and maybe even understandable (but that's another problem
. Normally I'd do something like this:
It's hardly complicated. And the individual procedures for handling the events are no more complex than any other event handling loop.
I'm sure you could get into problems if you have an unusual application structure, but I've never come across that. Maybe if you didn't have windows which done the same thing every time they were opened would cause a problem too. If you don't want to think about working with procedures, you can do the same thing with Gosubs.
Of course you could always separate the code out when you use different gadget IDs, but that's more work than checking the window ID.
PS, I'm not trying to have an argument with you, Fred or PB. The commands are there that you could do it this way if you like, although others would prefer each gadget having unique IDs. PB at least allows the possibility for both.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.20)
Edited by - tinman on 18 June 2002 00:14:39
I'd disagree with the "very, very bad choice" part, but I have no option since EventWindowID() doesn't work the way I'd likeAnd this gets more complicated the more windows you have.
Conclusion: this is a very, very bad choice.
I don't see why you'd have one huge event loop, especially if you want to keep the code modular and maybe even understandable (but that's another problem
Code: Select all
program_quit.w=0
Repeat
ev.l=WaitWindowEvent()
Select EventWindowID()
Case 0 : program_quit = handle_window_zero(ev)
Case 1 : program_quit = handle_window_one(ev)
EndSelect
Until program_quit=1
I'm sure you could get into problems if you have an unusual application structure, but I've never come across that. Maybe if you didn't have windows which done the same thing every time they were opened would cause a problem too. If you don't want to think about working with procedures, you can do the same thing with Gosubs.
Of course you could always separate the code out when you use different gadget IDs, but that's more work than checking the window ID.
PS, I'm not trying to have an argument with you, Fred or PB. The commands are there that you could do it this way if you like, although others would prefer each gadget having unique IDs. PB at least allows the possibility for both.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.20)
Edited by - tinman on 18 June 2002 00:14:39