Help with coding technique for multiple windows

Just starting out? Need help? Post your questions and find answers here.
The Mexican
User
User
Posts: 16
Joined: Sat Oct 07, 2006 5:47 pm
Location: Somewhere in Mexico

Help with coding technique for multiple windows

Post by The Mexican »

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).
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 »

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.
The Mexican
User
User
Posts: 16
Joined: Sat Oct 07, 2006 5:47 pm
Location: Somewhere in Mexico

I got it

Post by The Mexican »

I understand know windows and gadgets a little bit more. Thank you
Post Reply