Corrupted Graphics

BlitzPlus Forums/BlitzPlus Programming/Corrupted Graphics

Pepsi(Posted 2004) [#1]
Hi, for some reason when I maximize and minimize, Blitz Plus itself, not me, is not updating/redrawing the gadgets correctly. This example code below can only show when I minimize from a full maximized state that the "button" button gets left a left-over image of itself in the panel beneath it. Ofcoarse, when I simply barely resize the app's window, the app get's redrawn and everything is nice looking again. With my OpenGL application, when I full maximize the app, the big blitz-blue panel somehow corrupts half the "button" button and the little panel beneath it. Unfortunitly, I can not reproduce that I suppose because it had something to do with refreshing the openGL window.
Global winwidth=620
Global winheight=470

Global window=CreateWindow("Window",(ClientWidth(Desktop())/2)-(winwidth/2),(ClientHeight(Desktop())/2)-(winheight/2),winwidth,winheight)
SetMinWindowSize window,winwidth,winheight

Global mainpanel=CreatePanel(2,30,ClientWidth(window)-134,ClientHeight(window)-32,window,1)
SetGadgetLayout mainpanel,1,1,1,1
SetPanelColor mainpanel,34,85,119

Global thisbutton=CreateButton("button",ClientWidth(window)-130,30,128,18,window)
Global thispanel=CreatePanel(ClientWidth(window)-130,50,128,128,window,1)
SetPanelColor thispanel,34,85,119

Global menu=WindowMenu(window)
Global file=CreateMenu("&File",0,menu)
CreateMenu "&New",FILENEW,file
CreateMenu "&Load...",FILELOAD,file
CreateMenu "&Save",FILESAVE,file
CreateMenu "Save &As...",FILESAVEAS,file
CreateMenu "&Close",FILECLOSE,file
CreateMenu "",0,file
CreateMenu "&Quit",FILEQUIT,file
UpdateWindowMenu window

Const FILEQUIT=6

; ------------------
; Main
; ------------------
editor_exit=False
While editor_exit=False
	Select WaitEvent(10)
		Case $802
			ReSize()
			
		Case $803	;close window event
			Select EventSource()
				Case window
					editor_exit=True
			End Select

		Case $1001	;menu event
			Select EventData()
				Case FILEQUIT
					editor_exit=True
			End Select		
	End Select
	;DrawScene()
Wend
End

Function ReSize()
	SetGadgetShape thisbutton,ClientWidth(window)-130,30,128,18
	SetGadgetShape thispanel,ClientWidth(window)-130,50,128,128	
End Function


Mabie I'm doing something wrong or missing how to do something. Any suggestion or ideas would be apprieciated to help fix this.

Here's what it looks like after when I click the minimize button from the app being in a full maximize state:
[img deleted]

Here's what I can't reproduce without all my opengl code. This happens simply after a click to full maximize state:
[img deleted]


Pepsi(Posted 2004) [#2]
Nevermind...

I used this at the window sizing event to hack-fix it:
Case $802
HideGadget thisbutton
HideGadget thispanel
HideGadget mainpanel
ReSize()
ShowGadget thisbutton
ShowGadget thispanel
ShowGadget mainpanel

Since BlitzPlus, itself, fails to redraw correctly in situations like this, I figured out the Hide/ShowGadget trick so it will force a redraw to not get corrupted graphics.

Edit:
Actaully, to keep things even more simplier, I can use the the Hide/ShowGadgets on the main window by itself in this case and not on any other gadgets like I did above. But, it will cause more of a annoying flicker when minimizing, maximizing and sizing.