big error after unhide a canvas
Archives Forums/Linux Discussion/big error after unhide a canvas| 
 | ||
| Hey, here is sample code for you. After unhidden the canvas , i try to draw the loaded image. BUM, application collapse.... Application runs perfect without the gadgethidding thing. Is this a bug or a linux problem? 
Strict 
Import MaxGui.Drivers
Local fenster:TGadget = CreateWindow("Bug?",0,0,400,400,Null,WINDOW_TITLEBAR)
Local can:TGadget = CreateCanvas(0,0,400,300,fenster)
Local btn:TGadget = CreateButton("Load Image",140,350,120,25,fenster)
HideGadget(can)
Type Tileset
	Field img:TImage
	
	Method Laden:Byte()
		Local filter:String = "Image:png,jpg;"
		Local path:String = RequestFile("Load Image",filter)
		If ( Len(path) > 3)
			img = LoadImage(path)
			Return 1
		Else
			Print "Error Loading Image"	
			Return 0
		End If 
	End Method
	
End Type
Local a:Tileset = New Tileset
While True
	Select WaitEvent()
		Case EVENT_WINDOWCLOSE
			Exit
		Case EVENT_GADGETPAINT
			SetGraphics CanvasGraphics(can)
			If (GadgetHidden(can) = False)
				Cls
				DrawImage(a.img,0,0)
				Flip	
			End If	
		Case EVENT_GADGETACTION
			Select EventSource()
				Case btn
					If (a.Laden()=1)
						ShowGadget(can)
					EndIf 	
					
			End Select				
	End Select		
Wend 
in windows app works fine the error message : X Error of failed request: BadDrawable (invalid Pixmap or Window parameter) Major opcode of failed request: 14 (X_GetGeometry) Resource id in failed request: 0x3200007 Serial number of failed request: 4738 Current serial number in output stream: 4738 Last edited 2011 |