Fernand Vanrie escribió: > Ariel Constenla-Haile wrote: > > Ariel, thanks for your quick reply, but as i can not enter the > Defaultvalue in a listbox when Xraying > > oform.CbxTaal i get a empty table who learns me nothing :-)
mmm here I don't understand you Let's see if I get it... >> Fernand Vanrie escribió: >> >>> Hallo all, >>> First I treed to set with the GUI a a Default value into a FormControl >>> ListBox but no sucses, the opening ListBox stays empty and the entered >>> value disapered.... ? >>> >>> then i tried the same me thing using the API no sucses.......; >>> >>> my best gues was >>> >>> oform.CbxTaal.setPropertyvalue("Selecteditems","N") "N" is one of the >>> list entries >>> but here i have a error i need no string but a type short ?? how do >>> i produce this type short in Basic ? the error is obvious: css.awt.UnoControlListBoxModel: sequence< short > SelectedItems - specifies the sequence of selected items, identfied [sic. API typo] by the position. You must set a sequence of short values, even if you want only one item to be selected. The short value corresponds to the item position you want to select (index starts at 0). >> did you try >> http:///api.openoffice.org/docs/common/ref/com/sun/star/form/component/ListBox.html#DefaultSelection >> >> ? sample OOoBasic code: Sub Main Dim oDoc as Object oDoc = ThisComponent 'I assume there is a Writer doc 'with logical form, and 'its first component is the listbox Dim oForm as Object, oListBox as Object oForm = oDoc.getDrawPage().getForms().getByIndex(0) oListBox = oForm.getByIndex(0) oListBox.setPropertyValue( "StringItemList", _ Array( "Item 0", "Item 1", "Item 2", "Item 3", "Item 4") ) oListBox.setPropertyValue( "DefaultSelection", _ Array( 1, 3 ) ) oForm.reset() 'oListBox.reset() End Sub Note that css.awt.UnoControlListBoxModel::SelectedItems is *NOT* the same as css::form::component::ListBox::DefaultSelection (I show this with ::com::sun::star::form::XReset::reset(), which can be invoked on the form and/or the form control, the first resets the whole logical form to its default values). -- Ariel Constenla-Haile La Plata, Argentina "Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter." Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org