Hi Fernand, > again the secrets are in the control :-) > > oform = thisComponent.drawpage.forms.getbyname( "Ingave") > omodel = oform.CbxTaal > oControl = ThisComponent.CurrentController.getControl( omodel) > ' > ocontrol.selectitem("N", true)
This indeed changes the selection at the control only, not at the model, which means that when you save the document, the current selection in the listbox will not persist (since it's only the model which is saved). For your concrete problem of setting the selection programmatically, I am not sure if you really want to set the *default selection* (which is applied, for instance, when you call .reset at the control model), or the *current selection* (which is what you see immediately in the control. For the current selection, http://api.openoffice.org/docs/common/ref/com/sun/star/awt/UnoControlListBoxModel.html#SelectedItems is what you need to change. Dim nSelection(1) as Integer nSelection(0) = ... nSelection(1) = ... oControlModel.SelectedItems = nSelection() The values in the array need to be the 0-based indexes of the entries you want to select. For the default selection (which upon setting it is used as current selection, too, though you can change the current selection without changing the default selection), http://api.openoffice.org/docs/common/ref/com/sun/star/form/component/ListBox.html#DefaultSelection works out, the very same way as SelectedItems. > still have the question how to set a Default value with the GUI !! The *current selection* cannot be changed via the UI, for ... hmm, for no apparent reasons (except historical ones). What you can change is the *default selectio*, which, as said above, also changes the current selection when changed itself. For this, just press the "..." button in the "Default selection" line in the property browser, but make sure beforehand the list box actually has list entries. Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenh...@sun.com - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org