- This topic has 21 replies, 4 voices, and was last updated 17 years ago by Admin.
-
AuthorPosts
-
May 5, 2007 at 2:11 am #187932methodMember
Hi all. I have seen many applications that listview ONLY updates when new data is avilable or when current data changes. I am making an application that deals with similer case. But i don’t know how these applications achive this task. I tried to use timer to refresh my listview every few seconds(I am loading data from dynamic xml to listview.)But there is a big problem that i keep losing focouse on the form and i see many unessary refreshes!! Could any one show me a better solution to avoid these unessry refreshes?I know these profitional applications are using a method that i am not aware of.Thanks
May 5, 2007 at 2:20 am #187953AdminAdministratorIf rss listview then
refresh
End IfTried that?
May 5, 2007 at 2:32 am #187952methodMemberghoast . Could you explain to me how to use that and how it works? I never seen it before :-(( . Acutally the dynamic data is not rss. It is just dynamic xml generated from remote mysql)
May 5, 2007 at 3:14 am #187951DepartureMemberghost wrote if rss is diffrent from listview then call the refresh function
May 5, 2007 at 4:04 am #187950AdminAdministratorYep, exactly what Dep said…
All it’s doing is comparing the XML with the listview and seeing if they’re the same. If they’re not, then, like Dep said, it calls the function to refresh. I just put “refresh” in there because I figured it’d be easier to understand 😛
Hope you understand it now…
May 5, 2007 at 4:21 am #187949methodMemberThanks for both of you. ok. So how to compare rss with current listview? i posted my simple xml that is generated by php
artistname1
artistname1
image1.gif
2028574083
566
09898
artistname2
artistname2
image2.gif
2028574083
566
09898
...
May 5, 2007 at 7:14 am #187948AdminAdministratorWhat’s outputting to the listview? The whole XML file? Like, the artist, name, image, etc.? Or is it just the name of the song?
May 5, 2007 at 11:56 am #187947methodMemberThe whole xml file.
May 5, 2007 at 12:17 pm #187946autopilotMemberwhat I would do, is more like this
If rss rsscopy Then
rsscopy = rss
refreshlistview
End IfMay 5, 2007 at 3:06 pm #187945AdminAdministrator@autopilot wrote:
what I would do, is more like this
If rss rsscopy Then
rsscopy = rss
refreshlistview
End IfThat’s exactly what I was going to tell him to do next. Make a second, hidden listview and check it against the one displayed.
May 6, 2007 at 1:13 pm #187944methodMember@Ghost wrote:
@autopilot wrote:
what I would do, is more like this
If rss rsscopy Then
rsscopy = rss
refreshlistview
End IfThat’s exactly what I was going to tell him to do next. Make a second, hidden listview and check it against the one displayed.
Thanks for your suggestion .So if i need make to make a new listview do you think this line :If rss rsscopy
will do the compar? rss and rsscopy are listview names? If not . could any one show me how to compare them?May 7, 2007 at 12:47 am #187943AdminAdministratorNo, rss and rsscopy are what you’ve named the listviews. If you’ve named them rss and rsscopy, then yes, that’ll work. Otherwise, it’s whatever you’ve named them. Does that make sense?
May 7, 2007 at 2:08 am #187942autopilotMemberrss & rsscopy are the names of xml files… rss is the source xml and rsscopy would be a copy of rss… if those are the names of the xml files, then the if statement should work to compair the 2 xml files.
autopilot
May 7, 2007 at 3:00 am #187941AdminAdministratorOh, you’re doing it that way. I was thinking of loading the xml files into the program first… Autopiolt’s way would probably use less CPU, thus making it better. 😛
May 8, 2007 at 12:54 am #187940methodMember@Ghost wrote:
Oh, you’re doing it that way. I was thinking of loading the xml files into the program first… Autopiolt’s way would probably use less CPU, thus making it better. 😛
This is how i populate my listview. How to compare it with old listview data?I am totaly lost with your replies:-(
Dim objDoc As MSXML2.DOMDocument
Dim objNodelist As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Dim lvwItem As ListItem‘load the xml document
Set objDoc = New MSXML2.DOMDocument
objDoc.async = False
objDoc.Load “http://localhost/xmloutput.php”‘add all the song nodes into a nodelist
Set objNodelist = objDoc.selectNodes(“//song”)‘Clear the listview
ListView1.ListItems.Clear‘Loop through each song node and add to the list view
For Each objNode In objNodelist
Set lvwItem = ListView1.ListItems.Add(, , objNode.selectSingleNode(“artist”).Text)
lvwItem.SubItems(1) = objNode.selectSingleNode(“name”).Text
lvwItem.SubItems(2) = objNode.selectSingleNode(“image”).Text
lvwItem.SubItems(3) = objNode.selectSingleNode(“rating”).Text
lvwItem.SubItems(4) = objNode.selectSingleNode(“songid”).Text
lvwItem.SubItems(5) = objNode.selectSingleNode(“totalvotes”).TextNext objNode
-
AuthorPosts
Related
- You must be logged in to reply to this topic.