Closing a second open window

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Hi,

My app has two open windows that are like so:

If OpenWindow(0, ...
If OpenWindow(1, ...

My problem is: How do I close window number 1? If I click on the "X" at
the top-right, BOTH windows close. Even using "closewindow(1)" makes
both windows close instead of just window number 1...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

Here is a way to do that.

Code: Select all

 OpenWindow(0, 100, 100, 200,200, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "Window 1")
OpenWindow(1, 300, 300, 200,200, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "Window 2")

openedwindows=2

Repeat
ev.l=WaitWindowEvent()
  If ev.l=#PB_EventCloseWindow
    openedwindows-1
    CloseWindow(EventWindowID())
  EndIf
Until openedwindows=0
End
Hope it helps...


Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st

Edited by - mr.skunk on 18 September 2001 15:10:52
Post Reply