home *** CD-ROM | disk | FTP | other *** search
/ Palm Utilities / Palm_Utilities_CD-ROM_2001_2001.iso / files / internet misc / GetTLE 1.0 / GetTLE.exe / Src / Progress.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-14  |  1.9 KB  |  59 lines

  1. /*
  2.     GetTLE - Progress.c - Display a progress indicator
  3.     Copyright ⌐2000 Andreas Schneider
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #include <PalmOS.h>
  21. #include <unix_stdarg.h>
  22. #include "Progress.h"
  23. #include "GetTLERsc.h"
  24.  
  25. // remove the progress indicator from the form
  26. extern void ClearProgress(void)
  27. {
  28.   FormPtr Form=FrmGetActiveForm();
  29.   
  30.   // gotta do the Hide/Show stuff otherwise the text
  31.   // won't be deleted
  32.   FrmHideObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
  33.   FrmCopyLabel(FrmGetActiveForm(),GetTLEMainStatusLabel,"");
  34.   FrmShowObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
  35.   return;
  36. }
  37.  
  38. // Use to show progress
  39. extern void DisplayProgress(Boolean erase,Char *format,...)
  40. {
  41.   va_list args;
  42.   FormPtr Form=FrmGetActiveForm();
  43.   Char text[50]="";
  44.   
  45.   // only hide and show the label if the text can shrink in length
  46.   if (erase)
  47.   {
  48.     FrmHideObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
  49.   }
  50.   va_start(args,format);
  51.   StrVPrintF(text,format,args);
  52.   va_end();
  53.   FrmCopyLabel(Form,GetTLEMainStatusLabel,text);
  54.   if (erase)
  55.   {
  56.     FrmShowObject(Form,FrmGetObjectIndex(Form,GetTLEMainStatusLabel));
  57.   }
  58.   return;
  59. }