Unable to perform context Menu operation in Listview rows
Posted: Thu Aug 23, 2007 2:46 pm
I want to perform contecx menu operation for a selected rows in ListView.Like if I have 10 rows in List View then I want select 3rd and 5th row and get popup menu for the same means I want to first focus on selected row in ListView then want to get Contex Menu for that paricular row.Currentaly i am trying to do that by this code
Form* form = Application::FindFormTitle("Alarm manager",Ranorex::SearchMatchMode::MatchExact,true,5000);
ListView* lvCtrl = form->FindListView("AlmDisplayLV");
Mouse::MoveToControl(lvCtrl);
lvCtrl->Focus();
Ranorex::Element* items[] = lvCtrl->Element->FindChildren(Role::ListItem);
String *name = items[ElemIndex]->get_Name();
Ranorex::Element* item = lvCtrl->Element->FindChild(Ranorex::ListItem,name);
Mouse::ClickElement(item,MouseButtonType::RightButton);
ContextMenu::SelectItemText("Acked");
Here it is taking rows by values of first column but in my case each item have same value in first column so its always selecting first row.I want to select it by index not by value.I am trying to do it by GetChild() method but its not working.I am trying to make other column apart from first to use as a unique key but it not returing handler of element.
In other way Mouse::ClickElement() method take only Ranorex::Element its doesn't take array of Ranorex::Element so i can not pass it like
Mouse::ClickElement(items[ElemIndex],MouseButtonType::RightButton);
Please suggest me and help me to complete my logic.Its very critical and important.Thanks in advance
Form* form = Application::FindFormTitle("Alarm manager",Ranorex::SearchMatchMode::MatchExact,true,5000);
ListView* lvCtrl = form->FindListView("AlmDisplayLV");
Mouse::MoveToControl(lvCtrl);
lvCtrl->Focus();
Ranorex::Element* items[] = lvCtrl->Element->FindChildren(Role::ListItem);
String *name = items[ElemIndex]->get_Name();
Ranorex::Element* item = lvCtrl->Element->FindChild(Ranorex::ListItem,name);
Mouse::ClickElement(item,MouseButtonType::RightButton);
ContextMenu::SelectItemText("Acked");
Here it is taking rows by values of first column but in my case each item have same value in first column so its always selecting first row.I want to select it by index not by value.I am trying to do it by GetChild() method but its not working.I am trying to make other column apart from first to use as a unique key but it not returing handler of element.
In other way Mouse::ClickElement() method take only Ranorex::Element its doesn't take array of Ranorex::Element so i can not pass it like
Mouse::ClickElement(items[ElemIndex],MouseButtonType::RightButton);
Please suggest me and help me to complete my logic.Its very critical and important.Thanks in advance