Re: drawLine( ) fails?
- Posted by CoJaBo Aug 27, 2010
- 1119 views
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)