C-Pen Plus

Show a Progress Bar in the Status Area

Sometimes we want to break the rules. If you write into the status area of the screen, you must be aware that the next version of the operating system might destroy your graphics. On the other hand, the LCD is small and it is useful to show the progress of a long search in the status area instead of using application space.

Pocket History

This function draws a progress bar in the status area of the LCD screen. The input value is between 0 and 27. A negative value is used to erase the progress bar.

#include <ogui.h>

int ProgressBar( int pcount )     
             //  0 < pcount < 28   
            //  pcount < 0 erases the progress bar
{
OPTR pScreen;
WidgetDC *pWDC;

if (pcount > 27) pcount = 27;
pScreen = OGUI_GetScreen();

pWDC = (WidgetDC *) MCALL0( pScreen,  GetWidgetDC);

if ( pcount < 0 )
  WidgetDC_FillRect (pWDC, 3, 11, 28, 4, LCD_COL_WHITE, MODE_COPY);  
else
  {
  WidgetDC_DrawRect (pWDC, 3, 11, 28, 4, LCD_COL_BLACK, LINE_SOLID);
  WidgetDC_FillRect (pWDC, 3, 12, pcount, 2, LCD_COL_BLACK, MODE_COPY);  
  WidgetDC_FillRect (pWDC, 4+pcount, 12, 26-pcount, 2, LCD_COL_WHITE, MODE_COPY);  
       // not needed if progress is always forward
  }
MCALL1( pScreen, FreeWidgetDC, pWDC);
OGUI_PrepareDelay();  // force screen update while busy searching
return 0;
}

Free Software

J Notes

Games

Development Tools

Code Snippets

Developer Tips

Contract Development

FAQ

Contact



Hosted by BenLo Park.