window close error message

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 JoRo.

See someone here a msitake in the following code?
Under XP home closing the window genareates a Window errormessage.

Form1_hWnd=OpenWindow(0,100,100,400,400,#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget|#PB_Window_SystemMenu,"LIW-Organizer F. E.")
If Form1_hWnd=0 Or CreateGadgetList(Form1_hWnd)=0 : End : EndIf

Fenster1=WindowID()
close.s: Close.s="nein"

CreateMenu(1,Form1_hWnd)
MenuTitle("Hilfe")
MenuItem (73,"Versionsinfo")


Repeat
EventID=WaitWindowEvent()
Window = EventWindowID()
Select Window
Case 0
Select EventID
Case #PB_EventCloseWindow:Close="ja"
Case #PB_EventMenu
Select EventMenuID()
Case 73: Gosub Version
EndSelect
EndSelect
EndSelect
Until Close="ja"

Version:
Form4_hWnd=OpenWindow(3,WinX,WinY,620,520,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget, "Versionsinfo")

Return


Johannes
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 Pupil.

Put 'End' after the repeat:until loop and it works, without this the program return with an error the instant the command 'Return' is run after you've closed the window.
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 JoRo.

ups, where was it gone, my end? :)

thanks, Johannes
Post Reply