[api-dev] Enabling a XButton

2008-02-07 Thread Tobias Krais
Hi together,

I use Java and I created a dialog with a disabled XButton. Because of
some user interaction I now want to enable this button. But I don't know
how to do this. Can somebody help me?

Greetings, Tobias

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



Re: [api-dev] Enabling a XButton

2008-02-07 Thread Tobias Krais
Hi again,

> I use Java and I created a dialog with a disabled XButton. Because of
> some user interaction I now want to enable this button. But I don't know
> how to do this. Can somebody help me?

I found a solution:
-%<-
XControlContainer xControlCont = ...;

Object objectEditButton = xControlCont.getControl("ButtonName");

XButton xEditButton = (XButton) UnoRuntime.queryInterface(
XButton.class, objectEditButton);

XControl xEditControl = (XControl) UnoRuntime.queryInterface(
XControl.class, xEditButton);

XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, xEditControl.getModel());

try {
if (xPSet.getPropertySetInfo().hasPropertyByName("Enabled"))
xPSet.setPropertyValue("Enabled", true);
} catch (Exception exception) {
exception.printStackTrace(System.out);
}
-%<-

Greetings, Tobias

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