Closing a sub-window [MaxGUI]

BlitzMax Forums/BlitzMax Beginners Area/Closing a sub-window [MaxGUI]

I am making a program that opens up a little window(MENU_NEW) if you click a menu option it's written like this(not all the code):
While WaitEvent()

	Select EventID()
	
		Case EVENT_WINDOWCLOSE			
			End
			
		Case EVENT_MENUACTION
			
			Select EventData()
							
				Case MENU_EXIT
					End
		
				Case MENU_NEW								
                                 *Window code*
					
			End Select	
		
		Default					
		
	End Select

Wend

Problem is, when I click the close button in the corner of the little window, it closes both the main window and the little one. I only want it to close the little one. It seems to trigger the EVENT_WINDOWCLOSE, but that's the problem, it ends the program. How do I close only the little window without triggering the code under EVENT_WINDOWCLOSE? I'm guessing the little window should have its own seperate EVENT_WINDOWCLOSE?

-Thanks

		Case EVENT_WINDOWCLOSE			
			Select EventSource()
				Case MainWindow?
					End
				Case SmallWindow?
					FreeGadget SmallWindow
			EndSelect


Cool, thanks.