DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIAdem dialogbox list multiselection

Solved!
Go to solution

Hello,

 

I would like to select, by script, all the items in a list when I click the button "select all". Is there a way to do that?

DJacques_0-1684494780629.png

 

The MultiSelection option is enabled.

 

I tried that code with Selection, or MultiSelection, but it doesn't do what I want. The selection option always select the last element of the list. The MultiSelection option doesn't do anything.

 

Sub SelectAllButton_EventClick(ByRef This) 'Created Event Handler
  
  Dim ListIdx
  For ListIdx = 1 To MyList.Items.Count
    MyList.Selection(ListIdx)
'    MyList.MultiSelection(ListIdx)
  Next
  
End Sub

 

Thank you,

Jacques

 

 

 

 

0 Kudos
Message 1 of 3
(1,168 Views)
Solution
Accepted by topic author DJacques
' This should do it
Sub Select_All_EventClick(ByRef This) 'Created Event Handler
  Call ListBox1.MultiSelection().AddSelection(1,0)
End Sub

' To verify, have a separate button to show what is selected
Sub Show_Selected_EventClick(ByRef This) 'Created Event Handler
  Dim i
  For i = 1 To ListBox1.MultiSelection.Count
    Call MsgBoxDisp(ListBox1.MultiSelection(i).Text)
  Next
End Sub
0 Kudos
Message 2 of 3
(1,120 Views)

Perfect, that's exactly what I needed! Thanks!

0 Kudos
Message 3 of 3
(1,108 Views)