I'm experiencing strange behavior under OS3.5 with a custom list drawing
function that paints to an offscreen window first. I'm not sure that I'd
call it a bug, but there seems to be stuff going on inside the Window
Manager that is not well documented (or which I have missed) with regard to
how the draw state is handled when you WinSetDrawWindow() and go to draw
offscreen. I'm hoping that perhaps someone here has experienced this before
and can shed some insight.

Here's the function:

void MyListDrawFunc(Int16 nItem, RectangleType *rectBounds, Char **pszText)
{
 WinHandle winTemp;
 RectangleType rectWin;

 winTemp = WinSetDrawWindow(winText);

 WinEraseWindow();
 WinDrawChars(pszText[nItem], StrLen(pszText[nItem]), 0,0);
 WinSetDrawWindow(winTemp);

 RctSetRectangle(&rectWin, nLeftPos, 0, 148, 11);
 WinCopyRectangle(winText, winTemp, &rectWin, rectBounds->topLeft.x,
rectBounds->topLeft.y, scrCopy);
}

// winText was initialized earlier and is an offscreen window:
// winText = WinCreateOffscreenWindow(nMaxWidth, 11, screenFormat, &nError);
// yes, I know I should replace the constant 11 with the right function
call.
// I've also tried switching from screenFormat to genericFormat with no
luck.

On a black and white pre-3.5 device, this seems to work fine (haven't tried
them all, though). On a color 3.5 device, this also works fine. Using the
3.5 EZ ROM, however, my list items all end up drawing un-highlighted, even
when you put the pen down on an item. You see a small highlighted portion
(the inset width) on the far left side, but the rest of the text draws
non-inverted.

If I remove the offscreen window (which, the whole point of this is that
there is another UI control can manipulate nLeftPos -- it's a horizontal
scrollbar gadget used to adjust what you see in the list), it draws
correctly. It's like the draw state is being completely ignored when I draw
offscreen. I've tried WinPushDrawState() before and WinPopDrawState() after
the WinSetDrawWindow() call to explicitly preserve it, and it still doesn't
obey. I've even tried rigging the colors with WinSet*Color() to the Selected
colors, using the UIGet...() functions, and it STILL doesn't obey.

I'm stymied. Is there something I'm misunderstanding about the way the draw
state is handled for offscreen windows?

Peter




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to