B Bill Norris Active Member Licensed User Longtime User Mar 31, 2012 #1 I have 2 scrollviews on the activity. Scrollview1 is populated with labels. When you touch a label on one scrollview1, then scrollview2 populates with items that are related to the label touched on the scrollview1. That all works fine. However, when the user then touches a different label on scrollview1, it populates scrollview2 with a whole new set of labels, on top of the labels generated by the previous touch. I have the panel color set to transparent, so I end up with labels on top of other labels. I realize now that I need to first remove the previous labels before re-populating with new ones. I figured out how to do it, but my solution seems rather convoluted. Is there a simple way to get the total number of rows on a panel. I tried storing the number of rows in a variable, then, before re-populating with the new items: Code: Copy If scrollview2_rowcount>0 then for i=0 to scrollview2_rowcount-1 scrollview1.panel.removeview(lbl_item(i)) next but that generates an error on compile because lbl_item() has not been initialized at that point in the code. lbl_item() doesn't get initialized until the database has been read, which determines the number of rows required, as in Code: Copy lbl_item(cursor1.rowcount).initialize("")
I have 2 scrollviews on the activity. Scrollview1 is populated with labels. When you touch a label on one scrollview1, then scrollview2 populates with items that are related to the label touched on the scrollview1. That all works fine. However, when the user then touches a different label on scrollview1, it populates scrollview2 with a whole new set of labels, on top of the labels generated by the previous touch. I have the panel color set to transparent, so I end up with labels on top of other labels. I realize now that I need to first remove the previous labels before re-populating with new ones. I figured out how to do it, but my solution seems rather convoluted. Is there a simple way to get the total number of rows on a panel. I tried storing the number of rows in a variable, then, before re-populating with the new items: Code: Copy If scrollview2_rowcount>0 then for i=0 to scrollview2_rowcount-1 scrollview1.panel.removeview(lbl_item(i)) next but that generates an error on compile because lbl_item() has not been initialized at that point in the code. lbl_item() doesn't get initialized until the database has been read, which determines the number of rows required, as in Code: Copy lbl_item(cursor1.rowcount).initialize("")
klaus Expert Licensed User Longtime User Mar 31, 2012 #2 You should use this code: Code: Copy For i = scrollview2.Panel.NumberOfViews - 1 To 0 Step -1 scrollview2.Panel.RemoveViewAt(i) Next Best regards. EDIT: added Step -1 Last edited: Mar 31, 2012 Upvote 0
You should use this code: Code: Copy For i = scrollview2.Panel.NumberOfViews - 1 To 0 Step -1 scrollview2.Panel.RemoveViewAt(i) Next Best regards. EDIT: added Step -1
B Bill Norris Active Member Licensed User Longtime User Mar 31, 2012 #4 RE: Yes, I did find that I had to add Step -1 Upvote 0