Board index » delphi » Tlistview linked to another Tlistview

Tlistview linked to another Tlistview

Hi all,

I'd like to learn how to create a parent/child link between two TListViews.
When a person selects an item from the parent the child will narrow it's
record displays to only items that belong to that parent.  When NO item is
selected all child records will display.  This is not a database program but
simply a utility to check email from numerous accounts and show the email
accounts in the parent list and the email headers in the child TViewList.

Based on what I've been reading, I'm going to need to use the addObject() or
.data property to do this.... does this sound like I'm on the right track?

Thanks
KenK

 

Re:Tlistview linked to another Tlistview


Quote
In article <3b61d056_1@dnews>, KenK wrote:
> I'd like to learn how to create a parent/child link between two TListViews.
> When a person selects an item from the parent the child will narrow it's
> record displays to only items that belong to that parent.  When NO item is
> selected all child records will display.  This is not a database program but
> simply a utility to check email from numerous accounts and show the email
> accounts in the parent list and the email headers in the child TViewList.

> Based on what I've been reading, I'm going to need to use the addObject() or
> ..data property to do this.... does this sound like I'm on the right track?

Well, you need some way to associate the items to display in the second
listview with entries in the first one. How you do that is completely
dependent on how you store your data. If you have one list object for each
account it would make sense to store the reference to the list object into the
TListitem.Data property of the items in the first listview. You then use a
suitable event to detect when the user selects one item (i.e. oNSelectItem),
retrieve the object reference from the items Data property and hand it to a
routine that fills the second listview.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Re:Tlistview linked to another Tlistview


Thank you Peter, I will work on this and once I get working a solution, I'll
reply back to this thread for others to be able to use also.

cheers!
Ken

"Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message
news:VA.00007581.0141766e@antispam.compuserve.com...

Quote
> In article <3b61d056_1@dnews>, KenK wrote:
> > I'd like to learn how to create a parent/child link between two
TListViews.
> > When a person selects an item from the parent the child will narrow it's
> > record displays to only items that belong to that parent.  When NO item
is
> > selected all child records will display.  This is not a database program
but
> > simply a utility to check email from numerous accounts and show the
email
> > accounts in the parent list and the email headers in the child
TViewList.

> > Based on what I've been reading, I'm going to need to use the
addObject() or
> > ..data property to do this.... does this sound like I'm on the right
track?

> Well, you need some way to associate the items to display in the second
> listview with entries in the first one. How you do that is completely
> dependent on how you store your data. If you have one list object for each
> account it would make sense to store the reference to the list object into
the
> TListitem.Data property of the items in the first listview. You then use a
> suitable event to detect when the user selects one item (i.e.
oNSelectItem),
> retrieve the object reference from the items Data property and hand it to
a
> routine that fills the second listview.

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!
> Note: I'm unable to visit the newsgroups every day at the moment,
> so be patient if you don't get a reply immediately.

Other Threads