1

In Inno Setup I have a TNewRadioButton.

FullRadioButton: TNewRadioButton;

And it has the following Caption:

FullRadioButton.Caption := 'New Customer';

But the color of the text is black by default.
I am trying to change its color the following way but it doesn't work:

FullRadioButton.Font.Color := $FF0000;// doesn't work
FullRadioButton.Color := $FF0000// doesn't work

Can someone please tell me what i'm doing wrong?
Here is my full source code if needed: https://jsfiddle.net/uj3sxvkq/

yuval
  • 2,848
  • 4
  • 31
  • 51
  • 1
    You're out of luck here (not completely, but it's quite a lot of pain to subclass a control in Inno Setup). But you can workaround this by creating a radio button with empty caption and put a static text control by the radio. – TLama Mar 23 '15 at 09:37
  • what do you mean by "subclass a control"? – yuval Mar 23 '15 at 09:39
  • 1
    Intercept the control's window proc. Then you would need to paint the text over the text rendered by the system in the response to the `WM_PAINT` message. – TLama Mar 23 '15 at 09:39
  • what do you mean by this? – yuval Mar 23 '15 at 09:40
  • Then what does TNewRadioButton's Color property do? TRadioButton = class(TButtonControl) property Color: TColor; read write; end; TFont = class(TGraphicsObject) property Color: Integer; read write; end; – yuval Mar 23 '15 at 09:47
  • 1
    Very, briefly. Blame Delphi for that. That radio button is the OS' own, the system renders it. Even though Delphi publishes the `Font.Color` property, it doesn't render the control's text with this color. It lets only the system draw the control which uses its own default font color for the control (as defined by theme). – TLama Mar 23 '15 at 09:59
  • I intercepted the control's window proc like you said and now it works. thanks a lot! – yuval Mar 23 '15 at 10:12
  • What is the full code to change the color of the radio button? – Codename K May 09 '22 at 22:55

0 Answers0