[PB] PtOnOffButton fill color when armed

Hello,

I would like a PtOnOffButton that toggle when pressed (displaying an image)
to change it’s background color but I can’t make it working.

I’m setting the following resource of the widget :

PtSetResource(widget,Pt_ARG_ARM_FILL,Pt_TRUE,0);
PtSetResource(widget,Pt_ARG_ARM_COLOR,Pg_BLUE,0);

But no luck, the widget when armed is always of the same gray color.

Thanks for any tips/help

Regards,

jean-louis

Hi Jean-Louis

I have not been able to get the arm fill to work for a PtOnOffButton, but I did
get the background color to change by checking the state of the button and changing
the color depending on that state. Here is a sample of code:

short *state;

PtGetResource(widget, Pt_ARG_ONOFF_STATE, &state, 0);

if (state == 0) / means it is off /
PtSetResource(widget, Pt_ARG_FILL_COLOR, Pg_RED, 0);
else /
means it is on */
PtSetResource(widget, Pt_ARG_FILL_COLOR, Pg_GREEN, 0);


another possibility is to use a regular PtButton and set it to toggle and then
you can use the resources to do the Pt_ARG_ARM_FILL and Pt_ARG_ARG_COLOR.

Hope this helps
Regards

Brenda


Jean-Louis Villecroze <jlv@kirilla.com> wrote:

Hello,

I would like a PtOnOffButton that toggle when pressed (displaying an image)
to change it’s background color but I can’t make it working.

I’m setting the following resource of the widget :

PtSetResource(widget,Pt_ARG_ARM_FILL,Pt_TRUE,0);
PtSetResource(widget,Pt_ARG_ARM_COLOR,Pg_BLUE,0);

But no luck, the widget when armed is always of the same gray color.

Thanks for any tips/help

Regards,

jean-louis