Hello everyone, what i would like to do is something similar to what msn messenger does.
Every time someone pms you it will open another window similaer to every other chat window.
Now what I would like to know is how to do it? Is it possible to create an unknown number of windows and deal with events from every window??
Cheers
Dynamically creating windows and recieving events from them
Use WindowN = EventWindowID() to know which window produced the event.
You should use the same event loop:
One small example that you can run:
You should use the same event loop:
Code: Select all
Repeat
EventID=WaitWindowEvent()
Select EventWindowID()
Case 1
Case 2
EndSelect
Until EventID=#PB_EventCloseWindow
Code: Select all
If OpenWindow(0,100,150,450,100,#PB_Window_SystemMenu,"Test")
CreateGadgetList(WindowID())
ButtonGadget(2,300,30,50,25,"Test")
ButtonGadget(3,70,30,150,25,"Generate an event")
Repeat
EventID=WaitWindowEvent()
WindowN = EventWindowID()
Select EventID
Case #PB_EventGadget
Select EventGadgetID()
Case 2
OpenWindow(1,0,0,450,100,#PB_Window_SystemMenu,"Test")
CreateGadgetList(WindowID())
ButtonGadget(3,70,30,150,25,"Generate an event")
Case 3
MessageRequester("Window Event","This event was produced in window #" + Str(WindowN),0)
EndSelect
EndSelect
Until EventID=#PB_EventCloseWindow
EndIf
ARGENTINA WORLD CHAMPION