Hi Berned, thank you for this useful hint! I integrated it.
Greetings, Tobias Berend Cornelius schrieb: > Hi Tobias, > apart from your failure I noticed that you assigned the model properties > by means of the interface "com.sun.star.beans.XPropetySet". The > interface "com.sun.star.beans.XMultiPropertySet" would be much more > performant because by using "setPropertyValues() you can assign all > control properties with a single API-Call. > You just have to consider to pass the propertynames in alphabetical order. > Probably the following example can illustrate how to use > "XMultiPropertySet": > > public void insertRadioButtonGroup(short _nTabIndex){ > try{ > String sName = "OptionButton1"; > > // create a controlmodel at the multiservicefactory of the dialog > model... > Object oRBModel = > m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRadioButtonModel"); > > XMultiPropertySet xRBMPSet = (XMultiPropertySet) > UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); > // Set the properties at the model - keep in mind to pass the > property names in alphabetical order! > xRBMPSet.setPropertyValues( > new String[] {"Height", "Label", "Name", "PositionX", "PositionY", > "State", "TabIndex", "Width" } , > new Object[] {new Integer(8), "~First Option", sName, new > Integer(130), new Integer(200), new Short((short) 1), new > Short(_nTabIndex++),new Integer(150)}); > // add the model to the NameContainer of the dialog model > m_xDlgModelNameContainer.insertByName(sName, oRBModel); > sName = "OptionButton2"; > oRBModel = > m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRadioButtonModel"); > > xRBMPSet = (XMultiPropertySet) > UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); > // Set the properties at the model - keep in mind to pass the > property names in alphabetical order! > xRBMPSet.setPropertyValues( > new String[] {"Height", "Label", "Name", "PositionX", "PositionY", > "TabIndex", "Width" } , > new Object[] {new Integer(8), "~Second Option", sName, new > Integer(130), new Integer(214), new Short(_nTabIndex), new Integer(150)}); > // add the model to the NameContainer of the dialog model > m_xDlgModelNameContainer.insertByName(sName, oRBModel); > }catch (com.sun.star.lang.IllegalArgumentException iaex) { > throw new java.lang.RuntimeException("cannot happen..."); > }catch (com.sun.star.lang.WrappedTargetException wtex){ > throw new java.lang.RuntimeException("cannot happen..."); > }catch (com.sun.star.container.ElementExistException eeex){ > throw new java.lang.RuntimeException("cannot happen..."); > }catch (com.sun.star.beans.PropertyVetoException pvex){ > throw new java.lang.RuntimeException("cannot happen..."); > }catch (com.sun.star.beans.UnknownPropertyException upex){ > throw new java.lang.RuntimeException("cannot happen..."); > }catch (com.sun.star.uno.Exception ex){ > throw new java.lang.RuntimeException("cannot happen..."); > }} > > > Best regards > > Berend > > Tobias Krais wrote: >> Hi again, >> >>> I want to add two radio buttons on a dialog with the target, that the >>> user can choose one. But only one button is shown. >> >>> xPSetPP01.setPropertyValue( "Name", _radioPrint01 ); >> >>> xPSetPP02.setPropertyValue( "Name", _radioPrint02 ); >> >> I found the failure. The variables _radioPrint01 and _radioPrint02 had >> the same values. >> >> Greetings, Tobias >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]