Hi together 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.

What am I doing wrong?

-----%<-----
// create the dialog model and set the properties
Object dialogModel = xMultiComponentFactory.createInstanceWithContext(
                "com.sun.star.awt.UnoControlDialogModel", xComponentContext);
XPropertySet xPSetDialog = (XPropertySet) UnoRuntime.queryInterface(
                XPropertySet.class, dialogModel);
xPSetDialog.setPropertyValue("PositionX", new Integer(100));
xPSetDialog.setPropertyValue("PositionY", new Integer(100));
xPSetDialog.setPropertyValue("Width", new Integer(200));
xPSetDialog.setPropertyValue("Height", new Integer(100));
xPSetDialog.setPropertyValue("Title",
                new String("Druck auf verschiedenen Druckerschächten"));

// get the service manager from the dialog model
XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class,
                dialogModel);

// create the button model and set the properties
Object buttonModel = xMultiServiceFactory.createInstance(
"com.sun.star.awt.UnoControlButtonModel" );
XPropertySet xPSetButton = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, buttonModel );
xPSetButton.setPropertyValue( "PositionX", new Integer( 20 ) );
xPSetButton.setPropertyValue( "PositionY", new Integer( 70 ) );
xPSetButton.setPropertyValue( "Width", new Integer( 50 ) );
xPSetButton.setPropertyValue( "Height", new Integer( 14 ) );
xPSetButton.setPropertyValue( "Name", _buttonName );
xPSetButton.setPropertyValue( "TabIndex", new Short( (short)0 ) );
xPSetButton.setPropertyValue( "Label", new String( "Drucken" ) );

// Radio Button 01
Object printPages01 = xMultiServiceFactory.createInstance(
"com.sun.star.awt.UnoControlRadioButtonModel");
XPropertySet xPSetPP01 = (XPropertySet) UnoRuntime.queryInterface(
                XPropertySet.class, printPages01);
xPSetPP01.setPropertyValue( "PositionX", new Integer( 10 ) );
xPSetPP01.setPropertyValue( "PositionY", new Integer( 20 ) );
xPSetPP01.setPropertyValue( "Width", new Integer( 180 ) );
xPSetPP01.setPropertyValue( "Height", new Integer( 14 ) );
xPSetPP01.setPropertyValue( "State", new Short((short) 1));
xPSetPP01.setPropertyValue( "Name", _radioPrint01 );
xPSetPP01.setPropertyValue( "TabIndex", new Short( (short)1 ) );
xPSetPP01.setPropertyValue( "Label", _labelPrint01);

// Radio Button 02
Object printPages02 = xMultiServiceFactory.createInstance(
"com.sun.star.awt.UnoControlRadioButtonModel");
XPropertySet xPSetPP02 = (XPropertySet) UnoRuntime.queryInterface(
                XPropertySet.class, printPages02);
xPSetPP02.setPropertyValue( "PositionX", new Integer( 10 ) );
xPSetPP02.setPropertyValue( "PositionY", new Integer( 50 ) );
xPSetPP02.setPropertyValue( "Width", new Integer( 180 ) );
xPSetPP02.setPropertyValue( "Height", new Integer( 14 ) );
xPSetPP02.setPropertyValue( "Name", _radioPrint02 );
xPSetPP02.setPropertyValue( "TabIndex", new Short( (short)2 ) );
xPSetPP02.setPropertyValue( "Label", "Drucker Test");

// create a Cancel button model and set the properties
Object cancelButtonModel = xMultiServiceFactory.createInstance(
"com.sun.star.awt.UnoControlButtonModel" );
XPropertySet xPSetCancelButton = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, cancelButtonModel );
xPSetCancelButton.setPropertyValue( "PositionX", new Integer( 80 ) );
xPSetCancelButton.setPropertyValue( "PositionY", new Integer( 70 ) );
xPSetCancelButton.setPropertyValue( "Width", new Integer( 50 ) );
xPSetCancelButton.setPropertyValue( "Height", new Integer( 14 ) );
xPSetCancelButton.setPropertyValue( "Name", _cancelButtonName );
xPSetCancelButton.setPropertyValue( "TabIndex", new Short( (short)3 ) );

xPSetCancelButton.setPropertyValue( "PushButtonType", new Short(
(short)2 ) );
xPSetCancelButton.setPropertyValue( "Label", new String( "Cancel" ) );

// insert the control models into the dialog model
XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(
                XNameContainer.class, dialogModel);
xNameCont.insertByName(_buttonName, buttonModel);
xNameCont.insertByName(_radioPrint01, printPages01);
xNameCont.insertByName(_radioPrint02, printPages02);
xNameCont.insertByName(_cancelButtonName, cancelButtonModel);
-----%<-----

Can you help me?

Greetings, Tobias

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to