Re: Stellar Project

new topic     » goto parent     » topic index » view thread      » older message » newer message
gwalters said...

Can someone explain my mistake?

This does not work but I need it to work

snip...

This does work but I don't want the object where it puts it.

snip...

Any ideas what I am doing wrong.. thanks for help

This is a very common mistake when you first start out with drawing directly onto a window. We often assume that since controls persist visually on the window, so do the raw graphics we place there. This is however, simply incorrect. Your graphics might persist, but Windows will almost certainly draw over them again the next time anything happens to your window (move, resize, etc.). Your issue is made especially worse because the w32HOpen event occurs before the window is ever visible.

And so, to persist the graphics, you must only draw to the window during the w32HPaint event, like this:

-- declare your bitmap outside your events 
atom hbitmap 
 
procedure starWindowOpen (integer self, integer event, sequence params)--params is () 
 
	-- create the bitmap during the w32HOpen event 
	hbitmap =  createDIB( {pal, starTable[3]} ) 
	 
end procedure 
setHandler( starWindow, w32HOpen, routine_id("starWindowOpen")) 
 
procedure starWindowPaint( integer self, integer event, sequence params ) 
 
	-- draw the bitmap to the window during the w32HPaint event 
	copyBlt(starWindow,0,0,hbitmap) 
 
	 
end procedure 
setHandler( starWindow, w32HPaint, routine_id("starWindowPaint")) 
	 
WinMain(starWindow, Normal) 

You could also create a Pixmap instead of using createDIB, but you don't need both.

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu