Re: change freely the color of a TGTextButton

Rutger van der Eijk (r36@nikhef.nl)
Thu, 4 Feb 1999 11:06:29 +0100 (MET)


Hi Wei Xie,

You need to tell TGClient that the widget has changed with
NeddRedraw(...).

So your code becomes:

----

switch(GET_MSG(msg)) {
case kC_COMMAND:

switch(GET_SUBMSG(msg)) {
case kCM_BUTTON:
SetWindowAttributes_t wattr;
switch(parm1) {
case 1:
wattr.fMask = kWABackPixel;
gClient->GetColorByName("blue",wattr.fBackgroundPixel);
gGXW->ChangeWindowAttributes(fTestButton->GetId(),&wattr);
gClient->NeedRedraw(fTestButton);
break;

case 2:
wattr.fMask = kWABackPixel;
gClient->GetColorByName("red",wattr.fBackgroundPixel);
gGXW->ChangeWindowAttributes(fTestButton->GetId(),&wattr);
gClient->NeedRedraw(fTestButton);
break;
}
break;

case kCM_RADIOBUTTON:
etc...
------
(had to move SetWindowAttributes_t wattr; outside case statement.

Cheers,

Rutger