1. [Win32lib] setPenColor

Hello all Win32lib developers,

I found a problem in Win32lib v 0.57.8 17/June/2002
setPenColor must now be called with every drawLine( ).
Instead of :
setPenColor( id, getSysColor( COLOR_HILIGHT ) )
drawLine( id, x, y+1, x+size, y+1 )
drawLine( id, x, y+1, x, y+55 )

you must do this now:
setPenColor( id, getSysColor( COLOR_HILIGHT ) )
drawLine( id, x, y+1, x+size, y+1 )
setPenColor( id, getSysColor( COLOR_HILIGHT ) )
drawLine( id, x, y+1, x, y+55 )

I looked at fixing the problem but this is got to be the most 
code I have ever seen for seleting a pen and drawing a line. 
"Hoop jumping".

Euman
euman at bellsouth.net

==================================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.
==================================================================

new topic     » topic index » view message » categorize

2. Re: [Win32lib] setPenColor

> setPenColor must now be called with every drawLine( ).

Interesting dilemma, isn't it ?
Every call to drawLine(), calls createPen(), which calls replaceObject(), which
calls xSelectObject().
... so how's win32lib supposed to know, in advance, that we're done with this
pen, so it can restore the previous one,
which it should do before the *next* call to setPenColor, etc ?
I think that any 'fix' would entail *forcing* the programmer to call a function
to restore the previous pen, when done
with the current one, or else, or otherwise!
... and this would apply to pen width, and style, as well...
Pardon my rambling...
but it seems to me that createPen() could be doing some tracking *before* it
actually calls xCreatePen().
i.e:
IF we've been here before,
... with the same id/hdc,
...... we should restore the previous pen *before*
.......... creating another pen for the same id/hdc.

, or, is that what's happening already?

new topic     » goto parent     » topic index » view message » categorize

3. Re: [Win32lib] setPenColor

Since no one responded to my last blurb about this, I put a printf() behind
every call to xSelectObject() in win32lib,
then ran the following code in both an onOpen[], then an onPaint[], with
conflicting results.
In an onOpen[], there were 8 calls to xSelectObject(), as I expected, but in an
onPaint[], there were only 5 ( per
'paint' event ).
If the 'rule' regarding SelectObject() is to be taken literally, should the
results not be the same ???

< An application should always replace a new object with the original, default
object after it has finished drawing with
the new object. >

This is clearly happening in an onOpen[], so why not an onPaint[] ?
Perhaps someone could enlighten me ...

-- simple code --
setPenColor(w,Red)
drawLine(w,10,10,120,120)
setPenColor(w,Green)
drawLine(w,10,10,40,140)
setPenColor(w,Blue)
drawLine(w,10,10,140,10)
setPenColor(w,Black)
drawLine(w,10,10,60,100)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu