View previous topic :: View next topic |
Author |
Message |
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Mon Jan 08, 2007 12:02 am Post subject: how to read the items that are actually on the listview |
|
|
Greetings!
I have a button does a search. How do I read the items that I have return from the search that are showing in the listview?
thanks,
jic |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Jan 08, 2007 3:51 am Post subject: Re: how to read the items that are actually on the listview |
|
|
In the button's click event you can loop over the list items like so,
Code: | foreach(item; myListView.items)
{
// item.toString() is the item's text, etc.
} |
|
|
Back to top |
|
|
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Mon Jan 08, 2007 8:38 am Post subject: Re: how to read the items that are actually on the listview |
|
|
Chris Miller wrote: | In the button's click event you can loop over the list items like so,
Code: | foreach(item; myListView.items)
{
// item.toString() is the item's text, etc.
} |
|
So, is "item.toString()" an array of the fields of one listview item? |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Jan 08, 2007 10:40 am Post subject: Re: how to read the items that are actually on the listview |
|
|
In this example code, it loops through the items, where "item" is each ListViewItem. item.toString() gets that item's string representation, which is just the first column. To get other columns, you'll use the item's subItems property, with which you can loop through:
Code: |
foreach(item; myListView.items)
{
writefln("?s:", item.toString());
foreach(subItem; item.subItems)
{
writefln("...?s", subItem.toString());
}
}
| Tested on the listview example that comes with DFL and gives output: Quote: | bar:
cool:
fe:
...fi
...fo
...fum
foo:
...subfoo
...lastfoo |
|
|
Back to top |
|
|
|