Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Adding components to TListViewItems in code


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Jun 14, 2016 11:27 AM Last Post By: Lajos Juhasz
Michael Leahy

Posts: 239
Registered: 5/9/07
Adding components to TListViewItems in code  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 13, 2016 1:09 PM
Delphi XE7

I have code that successfully creates objects descending from TListBoxItem and adding them to a TListBox.

I'm trying to descend from TListViewItem so that I can do the same thing with a TListView but it tells me...

type
  TCandidateListViewItem = class(TListViewItem)
 
  public
 
 
    constructor Create(AOwner: TComponent); override;
 


... that the I "cannot override a non-virtual method" where I would have it create the extra components I need.

I've read http://docwiki.embarcadero.com/Libraries/XE7/en/FMX.ListView.TListView but it wasn't helpful.

Is there some example code showing how to add buttons and paintboxes to a TListView item?
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Adding components to TListViewItems in code  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 14, 2016 10:34 AM   in response to: Michael Leahy in response to: Michael Leahy
Am 13.06.2016 um 22:09 schrieb Michael Leahy:
Delphi XE7

I have code that successfully creates objects descending from TListBoxItem and adding them to a TListBox.

I'm trying to descend from TListViewItem so that I can do the same thing with a TListView but it tells me...

type
  TCandidateListViewItem = class(TListViewItem)
 
  public
 
 
    constructor Create(AOwner: TComponent); override;
 


You should be able to "reintroduce" it.

constructor Create(AOwner: TComponent); reintroduce;

and in it just call the inherited constructor:

inherited Create(AOwner);

Greetings

Markus
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: Adding components to TListViewItems in code
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 14, 2016 11:27 AM   in response to: Michael Leahy in response to: Michael Leahy
Michael Leahy wrote:

Delphi XE7

I have code that successfully creates objects descending from
TListBoxItem and adding them to a TListBox.

I'm trying to descend from TListViewItem so that I can do the same
thing with a TListView but it tells me...

type
  TCandidateListViewItem = class(TListViewItem)
 
  public
 
 
    constructor Create(AOwner: TComponent); override;
 


... that the I "cannot override a non-virtual method" where I would
have it create the extra components I need.

I've read
http://docwiki.embarcadero.com/Libraries/XE7/en/FMX.ListView.TListView
but it wasn't helpful.

Is there some example code showing how to add buttons and paintboxes
to a TListView item?

Maybe you can try the AfterConstruction method it's virtual.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02