Recent

Author Topic: CheckBox, RadioButton - background  (Read 3921 times)

yellowbit

  • New member
  • *
  • Posts: 22
CheckBox, RadioButton - background
« on: February 29, 2016, 11:43:39 pm »
I have a TShape on my form. On this shape is placed a TCheckBox and TRadioButton. In the design time they have transparent background (TSpape's color) as expected, but when the program is running, their backgrounds become grey. Why? Any ideas how to fix it? Changing ParentColor property doesn't help.

howardpc

  • Hero Member
  • *****
  • Posts: 3071
Re: CheckBox, RadioButton - background
« Reply #1 on: March 01, 2016, 10:51:56 am »
TCheckBox and TRadioItem in the LCL are widgets drawn by the OS, so their colours are determined by the OS widget and OS theme that is current. The various platforms Lazarus builds for and runs on differ somewhat in the customisability of such widgets, i.e. the Color property may (or may not) be respected by your particular OS.

Note that TShape is a graphic control. It cannot host or parent subcontrols. While you can drop a checkbox 'on' a TShape so that it lies within the shape's bounds, it is actually parented by the underlying form, and has no relationship to the shape that appears to contain it. Both the shape and the checkbox are parented by the form, and you can move the checkbox so it straddles the shape and the surrounding form area. Compare this with the effect of dropping a checkbox on a TPanel. You cannot then display the checkbox outside the parenting panel. If you drag it to the edge of the panel its display is clipped at the panel border.