[ListView] add image

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

[ListView] add image

Postby Lena » Thu Oct 05, 2017 5:08 am

Hi.
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.
Attachments
lv.jpg
lv.jpg (27.96 KiB) Viewed 184 times
Lena
BCBJ Master
BCBJ Master
 
Posts: 480
Joined: Sun Feb 06, 2011 1:28 pm

Re: [ListView] add image

Postby Lena » Thu Oct 05, 2017 5:39 am

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.
Lena
BCBJ Master
BCBJ Master
 
Posts: 480
Joined: Sun Feb 06, 2011 1:28 pm

Re: [ListView] add image

Postby Lena » Fri Oct 13, 2017 5:34 am

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
Lena
BCBJ Master
BCBJ Master
 
Posts: 480
Joined: Sun Feb 06, 2011 1:28 pm


Return to Technical

Who is online

Users browsing this forum: No registered users and 8 guests