Recent

Author Topic: Lazarus TListView not showing correct column header color  (Read 4228 times)

holmesshanea

  • Guest
Lazarus TListView not showing correct column header color
« on: December 01, 2015, 11:28:12 pm »
f I drop a TListView on a new application and set it's viewstyle property = vsReport, and then add columns. the Column header color is the same as the rest of the control, instead of the usual clButtonFace color I am use to.

Is this a Windows 10 thing?

wp

  • Hero Member
  • *****
  • Posts: 11856
Re: Lazarus TListView not showing correct column header color
« Reply #1 on: December 02, 2015, 01:19:37 am »
You have to turn off theming to see the btnFace color (Project inspector -> Project options -> Application -> uncheck "use manifest file to enable themes"). This step has been needed all the time since themes were introduced in Windows. The Windows 10 themes, however, are extremely ugly for grid-like controls.

holmesshanea

  • Guest
Re: Lazarus TListView not showing correct column header color
« Reply #2 on: December 02, 2015, 01:31:45 am »
Yup! That Worked!  Thank You!


kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: Lazarus TListView not showing correct column header color
« Reply #3 on: December 02, 2015, 02:15:09 am »
It is also possible to turn off themes for just the ListView and have themes enabled in the rest of the app:

Code: Pascal  [Select][+][-]
  1. UxTheme.SetWindowTheme(ListView1.Handle, NIL, '');

uxtheme has to be in the uses clause.
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

holmesshanea

  • Guest
Re: Lazarus TListView not showing correct column header color
« Reply #4 on: December 02, 2015, 03:10:51 am »
Awesome! Thanks for the additional info. I am sure it will come in very handy.

Shane

holmesshanea

  • Guest
Re: Lazarus TListView not showing correct column header color
« Reply #5 on: December 02, 2015, 04:20:54 pm »

That did not work for me. I do not get any errors, but the column headers still take on the theme.

I tried placing the code first in OnFormCreate, then in OnFormActivate, and lastly in OnFormShow.



It is also possible to turn off themes for just the ListView and have themes enabled in the rest of the app:

Code: Pascal  [Select][+][-]
  1. UxTheme.SetWindowTheme(ListView1.Handle, NIL, '');

uxtheme has to be in the uses clause.

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: Lazarus TListView not showing correct column header color
« Reply #6 on: December 02, 2015, 08:10:28 pm »
You are right. I have successfully used this trick with TPageControl, but for some reason it doesn't work for TListView.

Original thread: http://forum.lazarus.freepascal.org/index.php/topic,20795.msg121514.html#msg121514
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

 

TinyPortal © 2005-2018