Recent

Author Topic: TListView CustomDrawItem not working  (Read 8595 times)

HermanR

  • New member
  • *
  • Posts: 9
TListView CustomDrawItem not working
« on: June 17, 2015, 05:01:06 pm »
Hello all,

I have a TListView in vsReport and want to color some items.
I have 4 columns (= 3 SubItems)
OwnerDraw = False;

In all CustomDraw, AdvancedCustomDraw and DrawItem (7 times) I made a call to a logfile to tell the event is triggered.
It looks like only the the CustomDraw and CustomDrawItem, AdvancedCustomDraw and AdvancedCustomDrawItem are triggered
According to the doc, DrawItem should be triggered but is not, nor are CustomDrawSubItem and AdvancedCustomDrawSubItem

with OwnerDraw = true; I get the same results (except now I can see some values, which is correct)

Am I missing something here?
And how do I get the font changed in a single SubItem?

thanks in advance
Herman

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: TListView CustomDrawItem not working
« Reply #1 on: June 21, 2015, 03:21:47 pm »
Hi,
Please tell us more about your project/problem.
Maybe put in some code, or upload a test-project or your project if it's not too big.
BTW, are you sure you are in the right part of the board ?
this is about Other OS, What other OS are you using ?

« Last Edit: June 21, 2015, 03:24:02 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: TListView CustomDrawItem not working
« Reply #2 on: June 23, 2015, 09:34:18 am »
This may be able to help you with your project http://delphidabbler.com/articles?article=16. I had no problems implementing it in Lazarus.

JD
« Last Edit: June 23, 2015, 09:36:57 am by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

HermanR

  • New member
  • *
  • Posts: 9
Re: TListView CustomDrawItem not working
« Reply #3 on: June 23, 2015, 12:19:14 pm »
Thanks jc99 and JD,

I read the article and imported the project in Lazarus but didn't see any items in the list. They were lost in the conversion. After adding them the Alternating, Rainbow and Columns worked fine.
I skipped the Background Bitmap (didn't convert ok) and the Shaded had some strange effects.
In Delphi XE8 the items were not lost and all worked ok except with the background and shaded the lines were not always visible (depended on the mouse to go over it)
I compiled the Lazarus project for WinCE and none of the effects worked. All flat lists with row select.

I use Lazarus 1.4 / fpc 2.6.4 with the WinCE add-on.
In the project options I choose wince as a target, arm as the CPU family and add the LCL Widget Type wince.
I do not use a debugger because I'm a newbe and haven't worked out (yet) how to configure this.
I made a small WinCE demo to show what I'm trying to do but in the demo (build from scratch) I didn't even see any items in the list. So it's worse that in my project. I changed it with the same code that loads the items, but no change.

All I need is a list with the swipe working. (The TDBGrid doesn't do that).

Thanks again
Herman
« Last Edit: June 23, 2015, 12:37:49 pm by HermanR »

HermanR

  • New member
  • *
  • Posts: 9
Re: TListView CustomDrawItem not working
« Reply #4 on: June 24, 2015, 11:26:31 am »
Hello all,

I rebuild my screen using a TListBox with only the database key in it and in the DrawItem I draw all data, colors etc. It's simple and fast.

So for me the item is closed

Thanks for helping me
Herman

 

TinyPortal © 2005-2018