Recent

Author Topic: Bug in TListView custom draw item ?  (Read 4858 times)

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Bug in TListView custom draw item ?
« on: November 28, 2014, 02:04:19 pm »
Hi,
Today I did work with listview and saw a weird behavior:
I made a simple drag and drop demo for listview:
1- Add 10 item and set all items imageindex=-1.
2- Write dragdrop code for reorder items.
3- Test reorder and it work well.
4- Assign listview custom draw item and run again.
5- Now when I drag an item,item show new image !
6- Delete custom draw item procedure and now everything work fine!

Why?

I attached a sample project for you to test.

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Bug in TListView custom draw item ?
« Reply #1 on: November 29, 2014, 07:12:33 am »
Somebody please just download sample project and test it for confirm

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Bug in TListView custom draw item ?
« Reply #2 on: November 29, 2014, 02:00:44 pm »
@aradeonas
what is your OS and lazarus v?
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Bug in TListView custom draw item ?
« Reply #3 on: November 29, 2014, 02:10:32 pm »
Windows 8.1
Lazarus 1.2.6
FPC 2.6.2

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Bug in TListView custom draw item ?
« Reply #4 on: November 29, 2014, 02:31:43 pm »
>Assign listview custom draw item and run again.
There is no code in ListCustomDrawItem? you uploaded wrong test project?
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Bug in TListView custom draw item ?
« Reply #5 on: November 29, 2014, 03:10:09 pm »
No,Try drag and drop some item and reorder them,you will see what happen there,moved items get new icon!
That empty ListCustomDrawItem make it wrong,just remove that event from ListView and you will see everything works fine.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Bug in TListView custom draw item ?
« Reply #6 on: November 29, 2014, 04:01:14 pm »
 :-[  lol  :D

Oh my.....
this is something.....very funny
 i can't stop laughing

Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Bug in TListView custom draw item ?
« Reply #7 on: November 29, 2014, 04:09:42 pm »
Oh God,this is a good reason for me to laugh :D
Maybe we are wrong and I will appreciate any one can tell me what is wrong.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Bug in TListView custom draw item ?
« Reply #8 on: November 29, 2014, 04:30:48 pm »
i do not now what's wrong  with it lolololol maybe is a feature lolololololol :P
but as a temporary fix to do your job
add at the start of 
Code: [Select]
procedure TForm1.ListDragDrop(Sender, Source: TObject; X, Y: integer);
......
begin
 List.OnCustomDrawItem:=nil;  or in { ListStartDrag }
end before the end of the procedure
add
Code: [Select]
......................
List.OnCustomDrawItem:=@ListCustomDrawItem;  or in  {  ListEndDrag }
end;
« Last Edit: November 29, 2014, 04:44:38 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Bug in TListView custom draw item ?
« Reply #9 on: November 29, 2014, 05:00:00 pm »
Oh,Thank you @Never.
But It's really interesting to me to find out what cause this.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Bug in TListView custom draw item ?
« Reply #10 on: November 29, 2014, 05:11:12 pm »
from my point of view your code is correct and this is a bug
maybe more experienced users can confirm as well
and report it in the bug tracker
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: Bug in TListView custom draw item ?
« Reply #11 on: December 13, 2014, 12:49:21 am »
Any body else can check it?

 

TinyPortal © 2005-2018