Newbie question on closing a window

Just starting out? Need help? Post your questions and find answers here.
TheMexican
New User
New User
Posts: 6
Joined: Mon Nov 25, 2013 7:19 pm

Newbie question on closing a window

Post by TheMexican »

First of all, I would like to say hello to all of you Purebasic users. I am new to Purebasic (Used to program in PHP and Python).
I have the following code:

Code: Select all

OpenWindow(0,0,0,200,200,"Window 1",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

OpenWindow(1,0,0,100,100,"Window 2",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

SetActiveWindow(0)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
When I click and close a window, it closes both windows. How can I control closing a window without closing them all? I though the #PB_Event_CloseWindow should get caught by the active window?

Thanks

Using Purebasic 5.21 LTS
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Newbie question on closing a window

Post by IdeasVacuum »

Code: Select all

Define iExit.i = False
Define iEvent.i

OpenWindow(0,0,0,200,200,"Window 1",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindow(1,0,0,100,100,"Window 2",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)

Repeat
                  iEvent = WaitWindowEvent()
           Select iEvent

                   Case #PB_Event_CloseWindow

                        Select EventWindow()

                                    Case 0: CloseWindow(0) : iExit = #True
                                    Case 1: CloseWindow(1)
                        EndSelect
           EndSelect

Until iExit = #True
Welcome to PB and the Forum. You will like it here 8)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
TheMexican
New User
New User
Posts: 6
Joined: Mon Nov 25, 2013 7:19 pm

Re: Newbie question on closing a window

Post by TheMexican »

Thank you. Somehow I missed that CloseWindow() in the reference manual :oops:
infratec
Always Here
Always Here
Posts: 7586
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Newbie question on closing a window

Post by infratec »

No,

you missed

Code: Select all

EventWindow()
:mrgreen: :mrgreen: :mrgreen:
Post Reply