From a07dfa47fb69e370d8f3666094e30d026e980c6d Mon Sep 17 00:00:00 2001 From: Vincent de Lachaux Date: Tue, 3 Sep 2024 18:22:10 +0200 Subject: [PATCH] bf listbox.select() --- UI/Project/Sources/Classes/listbox.4dm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/UI/Project/Sources/Classes/listbox.4dm b/UI/Project/Sources/Classes/listbox.4dm index 906f379..65ef0a5 100644 --- a/UI/Project/Sources/Classes/listbox.4dm +++ b/UI/Project/Sources/Classes/listbox.4dm @@ -689,9 +689,22 @@ Function select($row : Integer) : cs:C1710.listbox // Update selection If (This:C1470.isCollection() || This:C1470.isEntitySelection()) - This:C1470.item:=This:C1470.getValue()[$row-1] - This:C1470.itemPosition:=$row-1 - This:C1470.items:=[This:C1470.item] + var $c : Collection + $c:=This:C1470.getValue() + + If ($c.length>=$row) + + This:C1470.item:=$c[$row-1] + This:C1470.itemPosition:=$row-1 + This:C1470.items:=[This:C1470.item] + + Else + + This:C1470.item:=Null:C1517 + This:C1470.itemPosition:=0 + This:C1470.items:=[] + + End if Else