Re: drawLine( ) fails?

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

The example code in the last post is incorrect- you shouldn't be doing any screen drawing operations outside of the OnPaint event handler.
A significant number of Win32Lib applications get this wrong, leading to often subtle screen corruption and portability issues.

The corrected coed is as follows:

include	win32lib.ew  
constant Main = create(Window, "Line", 0, 0, 0, 200, 200, 0)  
procedure onPaint_Main(integer self, integer event, sequence parms)  
  -- This gets run whenever the Main window needs redrawn.  
  setPenColor(self, Black)  
  drawLine(self, 10, 10, 190, 190)  
end procedure  
setHandler(Main, w32HPaint, routine_id("onPaint_Main"))  
  
WinMain(Main, Normal)  
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu