Page 1 of 1

[ListView] add image

PostPosted: Thu Oct 05, 2017 5:08 am
by Lena
I create item like DynamicAppearance.
Code: Select all
void __fastcall TForm1::FormShow(TObject *Sender)
   TListViewItem * item = ListView1->Items->Add();
   item->Data[L"FullName"] = TValue::From<UnicodeString>(L"good1");
   item->Data[L"FotterName"] = TValue::From<UnicodeString>(L"good2");
   item->Data[L"TextCount"] = TValue::From<UnicodeString>(L"good3");
   ListView1->Items->Add()->Data[L"MyImage"] = TValue::From<TBitmap*>(Image1->Bitmap); //AV
   //item->Data[L"MyImage"] = TValue::From<TBitmap*>(Image1->Bitmap); //AV

First chance exception at $3D774400. Exception class $C0000005 with message 'access violation at 0x3d774400: read of address 0x3d774400'. Process Project1.exe (4508)
How add image? Thanks.

Re: [ListView] add image

PostPosted: Thu Oct 05, 2017 5:39 am
by Lena
Also I have two buttons TGlyphButtonObjectAppearance. Joined the ListView with ImageList
Do not get them to add pictures. How to?
Code: Select all
   item->Data[L"ButtonMinus"] = TValue::From<int>(0);//index from ImageList
   item->Data[L"ButtonAdd"] = TValue::From<int>(1);//index from ImageList

Nothing happens. Pictures can not be seen.

Re: [ListView] add image

PostPosted: Fri Oct 13, 2017 5:34 am
by Lena
1. I found for image:
Code: Select all
   reinterpret_cast<TListItemImage *>(item->Objects->FindDrawable(L"MyImage"))->Bitmap = Image1->Bitmap;

I see image. No AV.

2. I did not understand how to work with TGlyphButtonObjectAppearance. I replaced them TImageObjectAppearance