Bug 166613 - To set the listbox Selection property, the ellipsis tool inserts unwanted values
Summary: To set the listbox Selection property, the ellipsis tool inserts unwanted values
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:25.8.0 target:25.2.5
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2025-05-16 23:54 UTC by Alfio Littletree
Modified: 2025-05-23 16:05 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alfio Littletree 2025-05-16 23:54:44 UTC
Description:
In the Dialog Editor, changing the "Selection" property for a Listbox control, the tool opened by the "..." button inserts in the property value, as expected, the 0-based index of the item selected by the user in the tool. Moreover, it adds also the index 0. 
Reading the XML code for the listbox, the first item and the correct item have both the dlg:selected="true". Setting the Multiselection property to "No" do not stop the bug.
Selecting n items in the "..." tool, it insert in the property value, over the n correct indexes, the zero index n times. For testing more selections, remember that the capability of selecting more items depends on the Multiselection property value and on fixing for the bug https://bugs.documentfoundation.org/show_bug.cgi?id=166612
Even when I selected the first item (index 0), the property value contains two zeroes, not only one.
The simplest workaround is to use the Multiline Editing button instead of "...", but the user must calculate the indexes.


Steps to Reproduce:
1. Create a dialog and insert a ListBox control in it.
2. While the new control is active, look at its properties in the General page.
3. In the "List entries" property, click the Multiline Editing button, write at least 2 rows, then click Ok
4. In the "Selected" property, click the "..." button on the right. 
5. When you see your items, select the second, then click Ok
6. The "Selected" property value is shown as "0";"1"

Actual Results:
The Selected property value contain n+n indexes: n zeroes and n 0-based indexes of the n items selected by the user in the tool.

Expected Results:
The Selected property value must contain only n indexes, the 0-based indexes of the n items selected by the user in the tool.


Reproducible: Always


User Profile Reset: No

Additional Info:
Tryed on Calc and Writer, I suppose happens also on other components.
I cannot test a version older than 7.2, but I reproduced the bug also in the recent version 25.2.3.2 and in this:

Version: 25.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 19f3b72f34c487dc97d582712d21734a7e055fd5
CPU threads: 2; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: threaded
Comment 1 Saburo 2025-05-21 12:22:37 UTC
Thank you for reporting the bug.
Reproduce
Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: bbb074479178df812d175f709636b368952c2ce3
CPU threads: 4; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Raster; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded

Version: 6.2.0.0.alpha0+
Build ID: 52f3046842ccb2a81e8eef6c744330567512e55b

author	Caolán McNamara
commit 52f3046842ccb2a81e8eef6c744330567512e55b

weld ListSelectionDialog
Change-Id: Id2aaec88bd864167e0815ddb675c27b10331247f
Reviewed-on: https://gerrit.libreoffice.org/61482
Comment 2 Commit Notification 2025-05-22 20:44:29 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bd0d3b460fe9d4aaaf2cefb78ff7dd85423b6066

Resolves: tdf#166613 wrong selection returned from forms listbox editor

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Caolán McNamara 2025-05-22 20:44:58 UTC
done in trunk, backport to 25.2 in gerrit
Comment 4 Commit Notification 2025-05-22 21:40:37 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/32b2333e36a81581cc4e1d6d962f3c30b171ee6d

Resolves: tdf#166613 wrong selection returned from forms listbox editor

It will be available in 25.2.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Alfio Littletree 2025-05-23 16:05:33 UTC
I tested the fix, in version: 25.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 3158b14e0b26875300a8098bc117a5e69b76f48f
CPU threads: 2; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: threaded

It works fine. Thanks to Caolán McNamara.
Also thanks to Saburo.