I have some questions about coding techniques when using multiple windows.
Questions:
1)
Repeat
event.l=WaitWindowEvent(10)
Until event=#PB_Event_CloseWindow
Does this code captures all window events or it only catches events on whaetever file the window was declared?
Same question as above but for gadgets.
in other words, if I have many windows with many gadgets, do all event code has to be in one .pb file?
What is the best coding technique to create many windows. Is it better to create a procedure for every window?
Any help will be appreciated.
P.S: Sometime on my december vacation I will translate the Purebasic help file to spanish (if there is no translation yet).
Help with coding technique for multiple windows
-
- User
- Posts: 16
- Joined: Sat Oct 07, 2006 5:47 pm
- Location: Somewhere in Mexico
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Your main loop will catch events for all of your opened windows. You can test EventWindow() to discover which window fired the event and respond accordingly. For gadgets, you don't reuse #gadgets to add gadgets to a second window's gadgetlist. All #gadgets in the program must be unique, so you will always know based on EventGadget() where a gadget event was fired from.
-
- User
- Posts: 16
- Joined: Sat Oct 07, 2006 5:47 pm
- Location: Somewhere in Mexico
I got it
I understand know windows and gadgets a little bit more. Thank you