Hi,
I have a tableview where I want to add the first item with a larger height (e.g. 150) as I want to display a larger image at the left side next to regular caption text. All other item which are added afterwards should be regular size.
Can anyone give me an idea how I can achieve this? If it is a style thing: I am rather new to it and would need somewhat detailed guidance.
Thanks in advance
Gernot
Hi,
Hi,
and thanks for the quick reply. In my code I do the following
//this is the one where I want the larger image
item := tv.Items.add;
item.bitmap.Assign(MyImage); <------------ where should I call the customize event?
item.Caption := ' My Image';
//now I want the regular items added
item := tv.Items.add;
item. Caption := 'ABCD';
and so on.
Where do I need to put the onCustomize call?
Thanks in advance
Gernot
The OnCustomize event is automatically called, its an event that you can implement when selecting the TMSFMXTableView and navigating to events in the object inspector. Each item from the items collection is passed as a parameter, so the item with the bitmap can be identified with the index or with a tag property as explained in the sample below:
Nearly there,
I use
procedure TfrmMain.tvMediaDetailItemCustomize(Sender: TObject;
AItem: TTMSFMXTableViewItem; AItemShape: TTMSFMXTableViewItemShape;
AItemControlShape: TControl);
begin
if AItem.DataString = 'BILD' then
begin
AItem.Shape.Height := 110;
AItem.ShapeLeftRectangleImage.Bitmap := bit.Bitmap;
end;
end;
but get an access violation after assigning the bitmap. bit is defined as a TTMSFMXBitmap
Kind regards
please verify if ShapeLeftRectangleImage is not nil and verify if you have enabled ioLeftRectangle in TMSFMXTableView1.ItemOptions
Thanks Pieter,
I had checked for nil but forgot the option
Kind regards
gernot
Pieter,
is there any way to get the image larger. I always get a rather small image regardless of the height of the item
Kind regards
Gernot
The ShapeLeftRectangleImage is aligned client inside the ShapeLeftRectangle, which is aligned mostLeft. It only automatically changes the height based on the item height, so if you wish to have a larger image, you can simply change the width with the following code:
Pieter Scheldeman2014-08-12 10:09:21
Got it: I need to set
AItem.ShapeLeftRectangle.Width
to be wider and get a larger image
Thanks for your patience
Gernot