SDuperStrict and MaxGUI?
BlitzMax Forums/BlitzMax Beginners Area/SDuperStrict and MaxGUI?| 
 | ||
| So far my program has been working fine and has been progressing well. To catch any unwanted bugs or leaks I decided to turn SuperStrict on and all hell broke loose. After what seemed an age of fixing code i still couldn't get it to work. Here is a simple bit of code that throws and error for me. in SuperStrict mode but not in any other mode. Error: Unable to convert from "int" to "TGadget" 
SuperStrict
Local style:Int = WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_STATUS
Local MainWindow:TGadget
MainWindow = CreateWindow("Test",200,200,800,600,0,style)
Repeat
	
	WaitEvent()
	
	
	Select EventID()
	
		Case EVENT_WINDOWCLOSE
			End
			
	End Select
	
	
Until KeyHit(KEY_ESCAPE)
 | 
| 
 | ||
| With SuperStrict you have to declare what kind of variable all your variables are. They default to integer. 
MainWindow = CreateWindow("Test",200,200,800,600,0,style)
CreateWindow returns a TGadget, but MainWindow is an integer. 
MainWindow:TGadget = CreateWindow("Test",200,200,800,600,0,style)
That should fix your problem(s). | 
| 
 | ||
| Group parameter is a TGadget, try this: 
SuperStrict
Local Style:Int = WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_STATUS
Local MainWindow:TGadget=CreateWindow("Test",200,200,800,600,Null,Style)
Repeat
	
	WaitEvent()
	
	
	Select EventID()
	
		Case EVENT_WINDOWCLOSE
			End
			
	End Select
	
	
Until KeyHit(KEY_ESCAPE)
 | 
| 
 | ||
| Well, in the code I posted I had it set up like this. 
Local MainWindow:TGadget
MainWindow:TGadget = CreateWindow("Test",200,200,800,600,0,style)
I changed it to the following: 
SuperStrict
Local style:Int = WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_STATUS
MainWindow:TGadget = CreateWindow("Test",200,200,800,600,0,style)
Repeat
	
	WaitEvent()
	
	
	Select EventID()
	
		Case EVENT_WINDOWCLOSE
			End
			
	End Select
	
	
Until KeyHit(KEY_ESCAPE)
The above throws the error " Identifier MainWindow not found" | 
| 
 | ||
| Yep, That worked. Thanks Tiger. WHat if I want to use the Group option though? Or does it not matter with CreateWindow? | 
| 
 | ||
| You can use group option with CreateWindow, test this code if you have time :) , click somewhere on the big window and you can see the diffrents. 
SuperStrict
Local Style:Int = WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_STATUS
Local MainWindow:TGadget=CreateWindow("Parent",200,200,800,600,Null,Style)
Local ChildWindow:TGadget=CreateWindow("Child",200,200,150,150,MainWindow,Style)
Local NotChild:TGadget=CreateWindow("Not Child",300,300,150,150,Null,Style)
Repeat
	
	WaitEvent()
	
	
	Select EventID()
	
		Case EVENT_WINDOWCLOSE
			End
			
	End Select
	
	
Until KeyHit(KEY_ESCAPE)
 | 
| 
 | ||
| Thanks. :) |