Hey Folks,

Hopefully this is an easy one.  I am running this on a Treo650, but I
want it to work on most color devices.  I added color to every other
line of a table for contrast, and this works fine.  However I have
problems once I start scrolling the table using the 5-way nav keys,
which changes the currently selected row as you press it (to be clear).

I can reproduce the problem like so:
1. Press 5-way nav key down till you reach the bottom of the table.
2. continue pressing down to force the table to start scrolling.
3. Every time a colored row is encountered it draws the row highlighted
in black instead of the default color.

So as I scroll down it alternates between the correct "selected row"
color on rows I don't shade, and black on the rows I did shade.  Below
is a snippet of code I am using in the table's custom draw function.

   // Draw the background color
   WinPushDrawState();
   if( !bPaintedLastRow )
   {
      bPaintedLastRow = true;
   
      // Get the Frame's color to lighten it.
      // Leave a little blue if we hit max.
      UIColorGetTableEntryRGB( UIFormFrame, &oldColor );
        newColor.r = min( oldColor.r * 5 / 2, 250 );
        newColor.g = min( oldColor.g * 5 / 2, 250 );
        newColor.b = min( oldColor.b * 5 / 2, 255 );
        
      // Set the color scheme
      UIColorSetTableEntry( UIFieldBackground, &newColor );
   }
   else
   {
      bPaintedLastRow = false;
           
      // Make sure the color we alternate with is white.
        newColor.r =  255;
        newColor.g =  255;
        newColor.b =  255;

      // Set the color scheme
      UIColorSetTableEntry( UIFieldBackground, &newColor );   
   }

   ... 

   WinPopDrawState();


I haven't worked with these UIColor methods much and I am hoping someone
can see an obvious mistake I made.

Thanks,

Aaron

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

Reply via email to