To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=106172
                 Issue #|106172
                 Summary|SelectedItems with Multiselection Listbox problem with
                        | first array element
               Component|Database access
                 Version|OOo 3.1.1
                Platform|PC
                     URL|
              OS/Version|All
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|none
             Assigned to|dbaneedsconfirm
             Reported by|voobase





------- Additional comments from voob...@openoffice.org Thu Oct 22 07:31:48 
+0000 2009 -------
I have been using a multiselection listbox as part of a dialog which is called
from a macro and used for a "Base" form and have found that it is not possible
to select the first element independantly by feeding an array to the
"SelectedItems" property. The problem which occurs is that the first element is
always selected even when the elements of the array do not assign the first
listbox item to be selected.

For example... 
Sub Test_Dialog_Multiselection_Listbox

dim varTestArray(3) as string
dim varSelectedItems(3) as integer

Rem... First construct an array for the List
varTestArray(0) = "One"
varTestArray(1) = "Two"
varTestArray(2) = "Three"
varTestArray(3) = "Four"

Rem... Access the model of the listbox which has been constructed with the
Dialog editor.

DialogLibraries.LoadLibrary( "Settings" )
DeviceDetails = CreateUnoDialog( DialogLibraries.Settings.TestListbox )
DeviceDetails.title = "Allocate the Systems you need"
DevicedetailsModel = DeviceDetails.Model

DeviceDetailsModel.GetByName("D_lbSystem").StringItemList() = varTestArray()

Rem... Now construct the varSelectedItems array and use the "SelectedItems"
property...

'varSelectedItems(0) = 0 Rem... "Should" enable selecting first list element
varSelectedItems(1) = 1 Rem... enables selecting second list element
varSelectedItems(2) = 2 Rem... enables selecting third list element
varSelectedItems(3) = 3 Rem... enables selecting fourth list element

DeviceDetailsModel.GetByName("D_lbSystem").SelectedItems = varSelectedItems()

i = DeviceDetails.Execute()

End sub


Note how the first element in the varSelectedItems array is commented out. When
the listbox is run it shows with all its four elements selected, indicating a
problem with controlling the first element this way. As expected, if other
elements of that array are commented out then the corresponding list element
does not show.

The only way to faithfully control the selection of all the elements is to use
an array like this instead... (and you must use the word "array")

DeviceDetailsModel.GetByName("D_lbSystem").SelectedItems = Array(1,2,3) 

... which would select the second, third and fourth elements of the list. The
problem with using this way is that it is not possible to programably control
the array elements, for example you can not use a variable with "1,2,3", such as
n = "1,2,3" and then Array(n), or using a array within an array such as
Array(OtherArray())

All this makes it not possible to programably control which elements of the list
is selected or not.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@dba.openoffice.org
For additional commands, e-mail: issues-h...@dba.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org
For additional commands, e-mail: allbugs-h...@openoffice.org

Reply via email to