Re: change freely the color of a TGTextButton

Wei Xie (xiewei@clever.weizmann.ac.il)
Thu, 4 Feb 1999 00:15:47 +0200 (IST)


Dear Fons,

In implementation TestMsgBox::ProcessMessage, I did some correction as
followed:

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

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

What I want is when clicking "close" button, the "test" can change to red,
and when clicking "test" button, it will change to blue.
But the result is :
o After clicking "close" button, nothing happen. If continue to click
"test" button, it will change to red.

o If start from the beginning, after clicking "test" button, nothing
happen, but if click it twice, it change to blue.

Is there anything wrong with my operation ?

Sincerely yours
Xie