Board index » off-topic » Change BK of a TRadioButton

Change BK of a TRadioButton


2003-10-11 12:07:49 AM
off-topic16
Hi,
how can I change the BackgroundColor of a RadioButton in TPW1.5?
I tried SerBkColor, but it doesn't work!
Cak you help me?
Thanks
Alexander Sulfrian
 
 

Re:Change BK of a TRadioButton

"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:
Quote
how can I change the BackgroundColor of a RadioButton in TPW1.5?
I tried SerBkColor, but it doesn't work!
The colors of Windows buttons generally are not modifiable short of
drawing the button yourself. I'm not sure if you want to go through
all that trouble since you have to take responsibility for all the
other logic for handling the radio buttons as well.
Good luck.
Kurt
 

Re:Change BK of a TRadioButton

Hi,
it is not fine, that I cannot change the color fof the RadioButtons!
But is there anywhere a unit to download that supports colorful
radioButtons?
Thanks
Alexander Sulfrian
@Kurt: Sorry for the Mails! I pressed in this program here the wrong button!
"Kurt Barthelmess (TeamB)" < XXXX@XXXXX.COM >schrieb im
Newsbeitrag news: XXXX@XXXXX.COM ...
Quote
"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:

>how can I change the BackgroundColor of a RadioButton in TPW1.5?
>I tried SerBkColor, but it doesn't work!

The colors of Windows buttons generally are not modifiable short of
drawing the button yourself. I'm not sure if you want to go through
all that trouble since you have to take responsibility for all the
other logic for handling the radio buttons as well.

Good luck.

Kurt

 

{smallsort}

Re:Change BK of a TRadioButton

Hi,
can I mayby set the backgrount transparent? I have seen a code for WinAPI in
c++, that does exactly that!
case WM_CTLCOLORBTN:
SetBkMode((HDC)wParam, TRANSPARENT);
return (long)GetStockObject(HOLLOW_BRUSH);
This you have to insert into the mai MessageLoop of a Program!
Can I use this Code with TPW1.5 (or BPW7)?
Thanks
Alexander Sulfrian
"Kurt Barthelmess (TeamB)" < XXXX@XXXXX.COM >schrieb im
Newsbeitrag news: XXXX@XXXXX.COM ...
Quote
"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:

>how can I change the BackgroundColor of a RadioButton in TPW1.5?
>I tried SerBkColor, but it doesn't work!

The colors of Windows buttons generally are not modifiable short of
drawing the button yourself. I'm not sure if you want to go through
all that trouble since you have to take responsibility for all the
other logic for handling the radio buttons as well.

Good luck.

Kurt

 

Re:Change BK of a TRadioButton

"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:
Quote
it is not fine, that I cannot change the color fof the RadioButtons!
No, it is not. But that's the way Microsoft designed their buttons.
Quote
But is there anywhere a unit to download that supports colorful
radioButtons?
Unfortunately I don't know how much TPW code is still around. You
might try a google search.
Good luck.
Kurt
 

Re:Change BK of a TRadioButton

"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:
Quote
can I mayby set the backgrount transparent? I have seen a code for WinAPI in
c++, that does exactly that!

case WM_CTLCOLORBTN:
SetBkMode((HDC)wParam, TRANSPARENT);
return (long)GetStockObject(HOLLOW_BRUSH);

This you have to insert into the mai MessageLoop of a Program!
Can I use this Code with TPW1.5 (or BPW7)?
I'm not sure when Microsoft introduced that message. Since you are
writing TPW code, I presume you are also running Windows 3.x. I don't
think the WM_CTLCOLORBTN messages were implemented until Win 32. If
they were, you can watch for that message and respond as indicated.
The equivalent Pascal code would probably be something like:
SetBkMode(Msg.WParam, TRANSPARENT);
Msg.Result := GetStockObject(HOLLOW_BRUSH);
Good luck.
Kurt
 

Re:Change BK of a TRadioButton

Quote
.. Since you are
writing TPW code, I presume you are also running Windows 3.x. ..
Hi,
oh no! I don't run Win3.x! I writing in TPW only, because we must do that at
school! Personal I am running Windows XP!
I will try it, but I don't know correctly, how I can watch for the Message!
IFRC I saw in the Help the TPW supports the WM_CTLCOLOR Message, can I also
use that?
Thanks!
Alexander Sulfrian
"Kurt Barthelmess (TeamB)" < XXXX@XXXXX.COM >schrieb im
Newsbeitrag news: XXXX@XXXXX.COM ...
Quote
"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:

>can I mayby set the backgrount transparent? I have seen a code for WinAPI
in
>c++, that does exactly that!
>
>case WM_CTLCOLORBTN:
>SetBkMode((HDC)wParam, TRANSPARENT);
>return (long)GetStockObject(HOLLOW_BRUSH);
>
>This you have to insert into the mai MessageLoop of a Program!
>Can I use this Code with TPW1.5 (or BPW7)?

I'm not sure when Microsoft introduced that message. Since you are
writing TPW code, I presume you are also running Windows 3.x. I don't
think the WM_CTLCOLORBTN messages were implemented until Win 32. If
they were, you can watch for that message and respond as indicated.
The equivalent Pascal code would probably be something like:

SetBkMode(Msg.WParam, TRANSPARENT);
Msg.Result := GetStockObject(HOLLOW_BRUSH);

Good luck.

Kurt

 

Re:Change BK of a TRadioButton

"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:
Quote
oh no! I don't run Win3.x! I writing in TPW only, because we must do that at
school! Personal I am running Windows XP!
<sigh>That is unfortunate. This is like being taught how to drive
using a horse and carriage.
Quote
I will try it, but I don't know correctly, how I can watch for the Message!
That type of message is sent to the parent of the button. So the
parent will need a method like:
procedure WMCtlColorBtn(var Msg: TMessage);
virtual WM_FIRST + WM_CTLCOLORBTN;
However, since WM_CTLCOLORBTN is not defined in your version of
OWindows.pas, you'll need to define it yourself. The value is $0135.
Quote
IFRC I saw in the Help the TPW supports the WM_CTLCOLOR Message, can I also
use that?
Since you are running on Windows XP, I don't know if you will get that
message or not. Under Win 32, a 32 bit application only gets
WM_CTLCOLORBTN (and related control specific) messages. But Win 32 may
send the "old style" messages to a 16 bit application like yours. You
may have to put in both handlers and see which one is called.
Good luck.
Kurt
 

Re:Change BK of a TRadioButton

Hi,
i have it!
This code is working:
procedure WMCtlColorBtn(var Msg: TMessage);
virtual WM_FIRST + WM_CTLCOLOR;
procedure WMCtlColorBtn(var Msg: TMessage);
begin
SetBkMode(Msg.WParam, TRANSPARENT);
Msg.Result := GetStockObject(HOLLOW_BRUSH);
end;
With this Code the Backgorund of the RadioButtons gets transparent.
The other Msg (WM_CTLCOLORBTN) you didn't get in the TPW Program!
OK! Thanks for all Help!
Alexander Sulfrian
"Kurt Barthelmess (TeamB)" < XXXX@XXXXX.COM >schrieb im
Newsbeitrag news: XXXX@XXXXX.COM ...
Quote
"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:

>oh no! I don't run Win3.x! I writing in TPW only, because we must do that
at
>school! Personal I am running Windows XP!

<sigh>That is unfortunate. This is like being taught how to drive
using a horse and carriage.

>I will try it, but I don't know correctly, how I can watch for the
Message!

That type of message is sent to the parent of the button. So the
parent will need a method like:

procedure WMCtlColorBtn(var Msg: TMessage);
virtual WM_FIRST + WM_CTLCOLORBTN;

However, since WM_CTLCOLORBTN is not defined in your version of
OWindows.pas, you'll need to define it yourself. The value is $0135.

>IFRC I saw in the Help the TPW supports the WM_CTLCOLOR Message, can I
also
>use that?

Since you are running on Windows XP, I don't know if you will get that
message or not. Under Win 32, a 32 bit application only gets
WM_CTLCOLORBTN (and related control specific) messages. But Win 32 may
send the "old style" messages to a 16 bit application like yours. You
may have to put in both handlers and see which one is called.

Good luck.

Kurt

 

Re:Change BK of a TRadioButton

"Kurt Barthelmess (TeamB)" < XXXX@XXXXX.COM >schrieb im
Newsbeitrag news: XXXX@XXXXX.COM ...
"Alexander Sulfrian" < XXXX@XXXXX.COM >wrote:
Quote

>how can I change the BackgroundColor of a RadioButton in TPW1.5?
>I tried SerBkColor, but it doesn't work!

The colors of Windows buttons generally are not modifiable short of
drawing the button yourself. I'm not sure if you want to go through
all that trouble since you have to take responsibility for all the
other logic for handling the radio buttons as well.

Good luck.

Kurt

It isn't fully right!
I find a way to change the background color of some components!
The following code change the bk-color of the components in Window!
procedure Window.WMCtlColorBtn(var Msg: TMessage);
var logBrush: TLogBrush;
begin
SetBkMode(Msg.WParam, TRANSPARENT);
logBrush.lbStyle := bs_Solid;
if (GetSysColor(COLOR_WINDOW) < RGB(25,25,25)) then
logBrush.lbColor := GetSysColor(COLOR_WINDOW) + RGB(25,25,25)
else
logBrush.lbColor := GetSysColor(COLOR_WINDOW) - RGB(25,25,25);
Msg.Result := CreateBrushIndirect(logBrush);
end;
Alexander Sulfrian
BUT: It doesn't work with Buttons! (but with RadioButtons)