Created On:  24-05-2010
 
In some instances it may not be possible to use the standard options for selecting multiple items in a Treeview object; such as the MultiSelect() or SelectList() functions, and it may only be possible to select a single item at a time.  How do you select multiple items in a Treeview Object?
 
The following solution involves overwriting the default SelectList() function for the Treeview object, so that it will accept multiple selections. The function accepts a ListofItems as a parameter, and is is entered directly below the Treeview definition in the Frame file:
 
[ ] Treeview Treeview1
     [ ] multitag "#1"
       <> "$59648"
   
     [ ] void SelectList(List of LISTITEM lsItems)
     
          Agent.SetOption(OPT_VERIFY_RESPONDING, False)
 
          this.PressKeys("")
 
          LISTITEM lsItem
         
          [ ] for each lsItem in lsItems
              this.Select(lsItem)
              this.ReleaseKeys("")
 
              Agent.SetOption(OPT_VERIFY_RESPONDING, True)
 
The following Testcase creates a list; populates the list with the items to be selected from the Treeview, and calls the Treeview's SelectList() function:
 
  [ ] testcase MultiSelect()
 
     LIST OF LISTITEM lsItems
 
     // Populate list with Items to select.
 
        lsItems = ({"Option1", "Option3", "Option5", "Option7", "Option9"})
 
     // Call the Treeview's SelectList function, passing in the list of Items
 
     Treeview.SelectList(lsItems)
 
Incident #2439633