void
DrawRunningText(
 char*   inStr,
 RectanglePtr  inDrawRectP,
 ViewPrefP  inPrefsP)
{
 RectangleType oldClip;
 UInt    len;

 // Set clip to drawing rectangle so we won't draw outsite window...
 WinGetClip(&oldClip);
 WinSetClip(inDrawRectP);

 // Erase previous text. If we're at a begining of a text, we delay the next
draw so
 // we'll get an effect of flashing the text.
 if (inPrefsP->flashCount != 0) {
  if (inPrefsP->flashCount < kTimesToFlash) {
   ULong ticks = TimGetTicks();

   if (inPrefsP->flashCount % 2 == 0) {
    WinEraseRectangle(inDrawRectP, 0);
    while (TimGetTicks() - ticks <= kDelayBetweenFlashes)
     ;
   }
   else {
    while (TimGetTicks() - ticks <= kDelayBetweenFlashes)
     ;
    WinEraseRectangle(inDrawRectP, 0);
   }
  }
  inPrefsP->flashCount--;
 }
 else {
  WinEraseRectangle(inDrawRectP, 0);
 }

 // Draw text starting one character after the last one drawn.
 // Resotre cliping area.
 len = StrLen(inStr);
 if (len == inPrefsP->lastDrawChar) {
  inPrefsP->lastDrawChar = 0;
  inPrefsP->flashCount = kTimesToFlash;
 }
 WinDrawChars(inStr+inPrefsP->lastDrawChar, len-inPrefsP->lastDrawChar,
     inDrawRectP->topLeft.x, inDrawRectP->topLeft.y);
 WinSetClip(&oldClip);

 // If we are not flashing the text (at the beginging of each cycle), move
the counter
 // of next character to draw.
 if (inPrefsP->flashCount == 0) {
  inPrefsP->lastDrawChar++;
 }
}

Regards,
Ramel Levin
CTO
The PalmMate Team

Gotta a Palm? Gotta visit www.PalmMate.com
----- Original Message -----
From: Ronnen Belkind <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 23, 1999 9:10 PM
Subject: Flashing Text


>
>
> I have an non-editable text field.
> I am trying to make the text within the field flash.
> Does anyone have a suggestion on a good/elegant way to do this?
>
> Thanks,
> Ronnen
>
>
>
>

Reply via email to