List Info

Thread: Adding two radio buttons on a dialog




Adding two radio buttons on a dialog
user name
2006-12-18 19:05:42
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: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

Adding two radio buttons on a dialog
user name
2006-12-18 19:42:36
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: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

C#, createInstance, msvcr71.dll
user name
2006-12-18 20:15:14
Hi,

I just spent 2 days figuring out that the reason I was
getting a 
FileNotFoundException with this error "The specified
module could not be 
found. (Exception from HRESULT: 0x8007007E)" thrown
from my c# code when 
I call createInstance was because msvcr71.dll could not be
found on the 
system. It seems as though openoffice should probably put
this dll in 
system32 when openoffice is installed. Or am I missing
something?

Adam

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )