Recent

Author Topic: [SOLVED] How to change color of TSplitter?  (Read 1660 times)

Slyde

  • Full Member
  • ***
  • Posts: 152
[SOLVED] How to change color of TSplitter?
« on: February 13, 2023, 06:20:00 pm »
In my small application, I'm giving the users the ability to set form color.  And while I have this set
Code: Pascal  [Select][+][-]
  1. Splitter1.Color := frmMain.Color;
  2. Splitter2.Color := frmMain.Color;
it still stays dove grey, even though the form itself changed color.  This is pretty straight-forward stuff, but it sure isn't working for me.
« Last Edit: February 13, 2023, 06:37:46 pm by Slyde »
Linux Mint 21.3
Lazarus 3.0

AlexTP

  • Hero Member
  • *****
  • Posts: 2577
    • UVviewsoft
Re: How to change color of TSplitter?
« Reply #1 on: February 13, 2023, 06:28:06 pm »
Try this
Code: Pascal  [Select][+][-]
  1.     Splitter.OnPaint:= @SplitterOnPaintDummy;
  2.     Splitter.Color:= clRed;
  3.  
  4. ....
  5.  
  6. procedure TfmMain.SplitterOnPaintDummy(Sender: TObject);
  7. begin
  8.   //empty, to disable themed paint
  9. end;
  10.  

Slyde

  • Full Member
  • ***
  • Posts: 152
Re: How to change color of TSplitter?
« Reply #2 on: February 13, 2023, 06:37:15 pm »
That worked. I wldve never guessed to do that. I guess it's good to have that way, though, giving splitters an out if you want them to stay grey when the form color changes.

Thanks for the help.
« Last Edit: February 13, 2023, 07:24:21 pm by Slyde »
Linux Mint 21.3
Lazarus 3.0

Hansvb

  • Hero Member
  • *****
  • Posts: 822
Re: [SOLVED] How to change color of TSplitter?
« Reply #3 on: May 02, 2024, 09:05:23 am »
Hi,

If I try the above, I lose the grip points. I assume that these also fall under the themed part. How can I change the color and keep the grip dots?

See the difference between left and right splitter. (Lazarus 3.0, win 11)

jamie

  • Hero Member
  • *****
  • Posts: 6988
Re: [SOLVED] How to change color of TSplitter?
« Reply #4 on: May 02, 2024, 11:44:15 pm »
I just did old 2.0.4 laz and the trunk,. it works fine here , I can set it to any color without that hack.

So maybe something has changed in the widget between these two?
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018