Recent

Author Topic: TCustomListView descendant and ImageIndex  (Read 3964 times)

mikiwoz

  • Full Member
  • ***
  • Posts: 130
TCustomListView descendant and ImageIndex
« on: February 13, 2005, 02:00:55 pm »
Hi everyone.

I have got an app that uses my own custom TCustomListView descendant to list out music files in the current directory. The information visible is Filename, Title, Author and so on, read from ID3 tags.
I want to implement sorting - but that I know how to do.
the problem is, when I will sort, I want to indicate which value (column) are the files being sorted by and whether it is desc or asc sorting. In Delphi I used to do it with a small image of arrow next to the column's name.
The arrows (up and down) were drawn and added to SmallImages in overriden Create of the Form (now it's done in the overriden Create of the list). Then, all I had to do was change the ImageIndex of the correct column.

The code in Laz (overriden Create of the list, a fragment):
Code: [Select]

var TmpImg:TBitmap;
(...)
  //Create the image list
  SmallImages:=TImageList.Create(Self);
  SmallImages.Width:=12;
  SmallImages.Height:=12;
 
  //Temp bitmap
  TmpImg:=TBitmap.Create;
  TmpImg.Width:=11;
  TmpImg.Height:=11;
 
  //Draw something
  with TmpImg.Canvas do
  begin
    Brush.Color:=clBtnFace;
    FillRect(0, 0, 11, 11);
    Pen.Color:=clRed;
    MoveTo(0, 0);
    LineTo(11, 11);
  end;
  //add to SmallImages
  SmallImages.Add(TmpImg, nil); //dodajemy bitmapke do SmallImages

  TmpImg.Destroy;


Now, Everything above is fine - the bitmap being created, drawn and saved to SmallImages (tested - it does exist in SmallImages afterwards). But when I change SomeColumns.ImageIndex:=0 - nothing happens. No image displayed.

This was tested on Linux, soon I will check it under Windows.

Any ideas, what's wrong? A bug, a "not implemented yet", or smthing? :)

Cheers
Mike

P.S.
Ceterum censeo Lazarus rox.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2680
TCustomListView descendant and ImageIndex
« Reply #1 on: February 14, 2005, 12:22:33 pm »
images in columns are not (yet) supported
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

mikiwoz

  • Full Member
  • ***
  • Posts: 130
TCustomListView descendant and ImageIndex
« Reply #2 on: February 14, 2005, 11:51:59 pm »
Ok, thanks, that makes it clear. Probably I'll try to implement it somehow on my own. :) But I wouldn't expect it to be anything special. ;)

Cheers
Mike

 

TinyPortal © 2005-2018