Jump to content
AaronCatolico1

*UPDATED!...Issue Populating The ListView Subitems

Recommended Posts

*UPDATED! So, the problem is that this particular listview is different than the VCL Listview. I guess FMX does things differently when populating this listivew. Does anyone know how to add the subitems or is it just not an option due to mobile applications? How do I add in the columns along with the rows?

 

I'm new to using Delphi and RAD Studio, so this has been a little bit of a learning curve for me, especially when most sources online say to write the syntax in a particular way and it only throws errors:

Anyhow, I was able to populate the ListView with only a single column and multiple rows. Most sources online say that this is how you populate a listview in a buttonclick event:

 

procedure TForm1.Button1Click(Sender: TObject);
var
    Item: TListViewItem;
    
    {Or possibly use the following:}
    Item: TListItem;
begin
    Item := ListView1.Items.Add;
    item.text := 'dude';
    item.subitems.add('bro');
end;

end.

 

Every time that I try to use the 'item.subitems.add', it throws the error: 'Undeclared Identifier' : 'subitems'.

 

Can someone show me an example of how to populate a listview control with items and subitems? Just a very simple example is all I need.

A good example would be 4 columns and 4 rows of data.

Thanks.

 

*I'm using RAD Studio 12 with firemonkey.

 

 

 

Edited by AaronCatolico1

Share this post


Link to post

So you can add a sub item:

  LsubItem := ListView1.Items.Add;

  LSubItem.Text := 'Sub-Item';

  LSubItem.Parent := LItem;

 

But I think you should try TListBox. FMX list box is more comparable to VCL list view.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×