Forum Discussion

Oferv's avatar
Oferv
Super Contributor
6 years ago

Expand a list item

Hi,

I want to select a random list from a list of few items and expand it by index.

I wrote a function to get the random list and select it but have some difficulties expanding it.

 

// Select random action from the actions list
  ActionToSelect = Random(1, Aliases.CCM.MainFrame.ContentControl.StackPanel.Control2.ListBox.wItemCount)
  Aliases.CCM.MainFrame.ContentControl.StackPanel.Control2.ListBox.ClickItem(ActionToSelect)

 

How can I expand the selected list item by index (Dblclick won't work here as the expanding should be perfomed from the expander, triangle icon in this case).

 

Thanks

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Is there a keyboard shortcut for doing the expansion? Like a right arrow or enter or tab?  I think it would be a bit tricky and a lot of code to find the triangle icon you're talking about (at least, sight-unseen not knowing what the component looks like).  I would simply send a "Keys" command to the control once you've selected the item you want and try that short cut.

  • Vallalarasu_P's avatar
    Vallalarasu_P
    Frequent Contributor

     

    Maxvalue = Aliases.CCM.MainFrame.ContentControl.StackPanel.Control2.ListBox.wItemCount
    Log.message ("Maxium Number of Value in the list: " &Maxvalue
    //Prevents out of bound
    RandomValue = Random(Maxvalue)
    Log.message ("Random Value in the list: " &RandomValue
    Aliases.CCM.MainFrame.ContentControl.StackPanel.Control2.ListBox.ClickItem(RandomValue)