Ranorex

How can Select multiple rows together in ListView

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
saurabh



Joined: 20 Jul 2007
Posts: 20
Location: India

PostPosted: Fri Jul 27, 2007 2:10 pm    Post subject: How can Select multiple rows together in ListView
I am trying to automate list view in my application and want to select multiple rows together to perform some opration but i am unable to do that it is selecting only one row at a time.Please guide me and send me the code for the same.
Thanks in Advance
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Fri Jul 27, 2007 5:25 pm    Post subject:
You can select multiple rows as follows
Code: click into code to enlarge
ListView listView = form.FindListView("listView1");
if (listView != null)
{
    listView.Focus();
    Element row1 = listView.Element.FindChild(Role.ListItem, "item1");
    row1.Select(Selection.TakeSelection);

    Element row2 = listView.Element.FindChild(Role.ListItem, "item2");
    row2.Select(Selection.AddSelection);
}

Hope this helps!

Gabor
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
saurabh



Joined: 20 Jul 2007
Posts: 20
Location: India

PostPosted: Mon Aug 20, 2007 10:15 am    Post subject: How to select mutiple rows by index
Here the above code is working fine but problem is here that we can not select the two rows which have same text.Like if in a listview under a column ITEM there is row's text same like "item1" ,"item1" then i am unable to select both row together it will take only one row .So is there any facility so that i can select the row on the base of their index?Then i think confilction will not occure.So please tell me how can i select multiple row uniquely using index of listview.
_________________
Regards,
Saurabh Shrivastava
GE Global Research
Bangalore India
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Tue Aug 21, 2007 11:14 pm    Post subject:
Quote:
...row's text same like "item1" ,"item1" then i am unable to select both row together it will take only one row


You can select all rows with the text "item1" as follows:

Code: click into code to enlarge
Element[] items = listView.Element.FindChildren(Role.ListItem,"item1");
foreach(Element item in items)
{
    item.Select(Selection.AddSelection);
}

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet All times are GMT + 2 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