FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to read the items that are actually on the listview

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Mon Jan 08, 2007 12:02 am    Post subject: how to read the items that are actually on the listview Reply with quote

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
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Mon Jan 08, 2007 3:51 am    Post subject: Re: how to read the items that are actually on the listview Reply with quote

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
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Mon Jan 08, 2007 8:38 am    Post subject: Re: how to read the items that are actually on the listview Reply with quote

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
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Mon Jan 08, 2007 10:40 am    Post subject: Re: how to read the items that are actually on the listview Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group