"Alan Ingleby" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Form Titles are always blue... I want a different colour for the form
title
> on certain forms in my app. can this be done, or is it a roll-your own
> affair?
> I'd also prefer if the solution would be OS3.5 compatible...

Spoke too soon... It's actually quite easy... Here's a nice code snippet for
others who might find it useful.

Call Reddify(true) to make to form title Red, Reddify(false) to restore it.
The code is smart enough to detect whether or not it should be attempting
these colour changes based on # device colours, and OS version.

//////////////////////////////////////////////

static RGBColorType colOrig;

static void Reddify(Boolean bRed) {

 RGBColorType  colOld;
 RGBColorType  colNew;
 UInt32    romVersion;
 UInt32    iDepth;

 FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);

 if (romVersion >= sysMakeROMVersion(3,5,0,sysROMStageRelease,0)) {

  if (!WinScreenMode(winScreenModeGet, NULL, NULL, &iDepth, NULL)) {
   if (iDepth >= 8) {
    UIColorGetTableEntryRGB(UIFormFrame, &colOld);
    MemMove(&colNew, &colOld, sizeof(RGBColorType));
    colNew.r = 200;
    colNew.g = 0;
    colNew.b = 0;
    UIColorSetTableEntry(UIFormFrame, &colNew);
    UIColorGetTableEntryRGB(UIFormFrame, &colNew);

    if (MemCmp(&colNew, &colOld, sizeof(RGBColorType))) {
     colOrig = colOld;
    }

    UIColorSetTableEntry(UIFormFrame, bRed?&colNew:&colOrig);
   }
  }
 }
}



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

Reply via email to