Hi Thomas,

Buttons and other UI controls are not drawn using the ForeColor. You must not set the ForeColor before you draw your button, you must set the UI Color.

In your case you will want something like:

Err err = UIColorSetTableEntry( UIObjectForeground, &fg );

static void tunerFormInit (FormPtr pForm)
{
        UIColorGetTableEntryRGB( UIObjectForeground, &fg );

        ControlType *pButton = getObjectPtr(pForm,tuner1Button);
        UIColorSetTableEntry( UIObjectForeground, &red );
        CtlDrawControl(pButton);
        pButton = getObjectPtr(pForm,tuner2Button);

        UIColorSetTableEntry( UIObjectForeground, &blue );
        CtlDrawControl(pButton);
 
        UIColorSetTableEntry( UIObjectForeground, &fg );
}

I haven't tested it, but it should work.

Hope it helps!

Cheers!
Terence

On 6/18/06, Thomas Jensen <[EMAIL PROTECTED]> wrote:
On Sat, 17 Jun 2006 16:33:20 -0500, "Dmitry Grinberg"
<[EMAIL PROTECTED]> wrote:


Thank you very much for your answer.

>set the UI color, call CtlDrawControl, and set UI color back.

Like this?

        static void
tunerFormInit (FormPtr pForm)
{
        WinSetForeColorRGB(NULL,&fg);

        ControlType *pButton = getObjectPtr(pForm,tuner1Button);
        WinSetForeColorRGB(&red,NULL);
        CtlDrawControl(pButton);

        pButton = getObjectPtr(pForm,tuner2Button);
        WinSetForeColorRGB(&blue,NULL);
        CtlDrawControl(pButton);

        WinSetForeColorRGB(&fg,NULL);
}

It looks like it should work, but it doesn't. Anyone have an idea why?



>in event handler look for ctlEnter, and then set the color for that
>button, and keep it so till ctlExit or ctlSelect


Ehhh... This is only needed if I want to change color when the button
is tapped, right?


Thomas


=============================================================

>On 6/17/06, Thomas Jensen < [EMAIL PROTECTED]> wrote:
>> On Sat, 17 Jun 2006 02:17:27 -0500, "Ben Combee"
>> <[EMAIL PROTECTED]> wrote:
>>
>> >On 6/17/06, Thomas Jensen <[EMAIL PROTECTED]> wrote:
>> >> Hi
>> >>
>> >> What API function can change the color of the text on a button?
>> >
>> >You can change the color for all buttons by adjusting the system's
>> >color pallette, but there are no functions to make a single button
>> >draw in different colors from the rest.  Have you considered a graphic
>> >button with your own bitmaps?
>>
>> Well, I should use 48 different graphics then... It would be much
>> easier just to change the color of the text on the button. So, I guess
>> default black must be fine...  But thanks for your answer.
>>
>>
>> --
>> Thomas Jensen
>>  - IDE? Real programmers use EDLIN...
>>
>> --
>> For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
>>
>
>
>--
>Best Regards, Dmitry Grinberg
>Software Engineer, http://PalmPowerups.com
>(847) 226 9295
>AIM: hacker19180
>MSN: [EMAIL PROTECTED]
>ICQ: 165589894
>Y! IM: dmitrygr2003

--
Thomas Jensen
- IDE? Real programmers use EDLIN...

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

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

Reply via email to