Thanks for the pointer Carsten. I finally got into it and thought I
figured it out but still haven't been able to get it to work. Right now
I'm trying to change my DispatchProvider, since all I'm trying to
control are my own buttons.
1.) I add a statuslistener when my button "Lesson" gets dispatched,
which I can only do in the queryDispatch method:
public XDispatch queryDispatch(URL arg0, String arg1, int arg2) {
XDispatch xRet = null;
if (arg0.Protocol.compareTo("org.openoffice.addon.Editor:") == 0) {
if (arg0.Path.compareTo("Lesson") == 0) {
xRet = this;
state1 = new StatusListener();
xRet.addStatusListener(state1, arg0);
}
}
return xRet;
}
2.) Now I try to send a FeatureStateEvent to this listener which should
disable the button on clicking it. Nothing happens although the
statusChanged method gets called, the button stays enabled.
public void dispatch(URL arg0, PropertyValue[] arg1) {
if (arg0.Path.compareTo("ElmlLesson") == 0) {
FeatureStateEvent aState = new FeatureStateEvent();
aState.FeatureURL = arg0;
aState.IsEnabled = false;
aState.State = Boolean.FALSE;
state1.statusChanged(aState);
}
...
I'm pretty sure there's something I forgot. :)
Carsten Driesner schrieb:
Jimmy wrote:
2.) How can I gray-out and enable commands at runtime? I got my
DispatchInterceptor to gray out commands when initiated but how can
I change the behaviour at runtime? Do I have to write more than one
DispatchProviderInterceptor and release and register them all the
time depending on the context?
Hi Jimmy,
The user interface elements register themselves at the dispatch
objects as listeners. These objects are responsible to provide the
correct state to the listeners (via
com.sun.star.frame.XStatusListener::statusChanged ). Therefore the
dispatch objects (provided by your dispatch interceptor) must call
statusChanged on the listeners to offer the correct state information.
Regards,
Carsten
---------------------------------------------------------------------
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]