Recent

Author Topic: Pagecontrol - Panels - style  (Read 1243 times)

wp

  • Hero Member
  • *****
  • Posts: 10296
Re: Pagecontrol - Panels - style
« Reply #15 on: September 30, 2022, 06:25:48 pm »
As I wrote above, this is not possible with the standard LCL TRadioButtons. The same as in Delphi's VCL, BTW. Basically this should be documented on page Restrictions of the object inspector (or in the Restriction Browser in menu View), but I would not swear that these entries are up-to-date.

Lulu

  • Full Member
  • ***
  • Posts: 171
Re: Pagecontrol - Panels - style
« Reply #16 on: September 30, 2022, 09:59:14 pm »
Hi, to customize font's color on TCheckBox and TRadioButton, I do the following:
  • Set an empty caption on radio button or check box
  • Add a TLabel with the appropriate caption and anchor it to the right of the radio button or check box
  • For a radio button: in TLabel.OnClick event, set the Checked radio button property to TRUE
  • For a checkbox: in TLabel.OnClick event, toogle the state of Checked property
You can then modify the font color of the TLabel as your needs.
Attached a simple project to demonstrate.
wishing you a nice life

KodeZwerg

  • Hero Member
  • *****
  • Posts: 568
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Pagecontrol - Panels - style
« Reply #17 on: October 01, 2022, 11:39:47 am »
Hi, to customize font's color on TCheckBox and TRadioButton, I do the following:
When I would do that, I would SubClass and OwnerDraw.

My own try for a full working Windows DarkTheme support (created in Delphi not FPC!) is available here https://www.delphipraxis.net/207862-kodezwergs-real-theme-beispiel.html
It actually really react on OS changes for that matter but my own try looks not that pretty like if you would use Styles.
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 568
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Pagecontrol - Panels - style
« Reply #18 on: October 01, 2022, 03:19:42 pm »
As I wrote above, this is not possible with the standard LCL TRadioButtons. The same as in Delphi's VCL, BTW. Basically this should be documented on page Restrictions of the object inspector (or in the Restriction Browser in menu View), but I would not swear that these entries are up-to-date.
No.
I proof it with images.
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

VisualLab

  • New Member
  • *
  • Posts: 48
Re: Pagecontrol - Panels - style
« Reply #19 on: October 01, 2022, 03:24:10 pm »
Hmm... Maybe it would be easier and safer:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.ApplyFonts;
  2. var
  3.   i: Integer;
  4. begin
  5.   if FFont = nil
  6.    then FFont := TFont.Create;
  7.   try
  8.     FFont.Name := 'Arial';
  9.     FFont.Color := clGreen;
  10.     FFont.Size := 11;
  11.     for i := 0 to Pred(Self.ControlCount) do
  12.       begin
  13.         try
  14.           TControl(Self.Controls[i]).Font := FFont;
  15.         except
  16.         end;
  17.       end;
  18.   finally
  19.   end;
  20. end;
  21.  

As it concerns the program window (TForm), it has a list of controls (Controls property) and their quantity (ControlCount property). It inherits them from the TWinControl class.

wp

  • Hero Member
  • *****
  • Posts: 10296
Re: Pagecontrol - Panels - style
« Reply #20 on: October 01, 2022, 03:39:14 pm »
As I wrote above, this is not possible with the standard LCL TRadioButtons. The same as in Delphi's VCL, BTW. Basically this should be documented on page Restrictions of the object inspector (or in the Restriction Browser in menu View), but I would not swear that these entries are up-to-date.
No.
I proof it with images.
Well, you turn off theme-services, and if you do this it works out of the box: Just set TRadioButton.Color and TRadioButton.Font.Color in the Object Inspector. Since the OI runs WITH theme services you do not get a visual feedback, but when the program runs the background and text colors have taken the corresponding values. Of course, only without theme-services. This results in the Win95 look. If you like that - fine; if you don't the same problem again.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 568
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Pagecontrol - Panels - style
« Reply #21 on: October 01, 2022, 04:01:50 pm »
@wp: I do agree your current post but not the post where you said it is not possible. That without themes it works out of box i do know, my method is just a general helper without need to type "radiobutton1.color, radiobutton1.font.color etc..." i can throw in whatever control and it works "out-of-box" :))
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

Nicole

  • Hero Member
  • *****
  • Posts: 500
[solved] Re: Pagecontrol - Panels - style
« Reply #22 on: October 03, 2022, 09:14:54 am »
I installed BGRAD in the meanwhil and tried it, - and to sum it up: I will uninstall it.
There seems to be no RadioBox,  demos I cannot find.

ExCtrls is downloading at the moment for the next try.

PS
 - done-
Thank you KodeZwerg.
I solved it by exctrl
and thank all others for the answers as well!
« Last Edit: October 03, 2022, 01:37:02 pm by Nicole »

 

TinyPortal © 2005-2018