Hello Oliver,

If you wish to force a synchronous execution of your dispatch you should
try the argument "Asynchron" as [bool] with a valud "false".

are you sure, this works ?
I can see no difference ... the preview is not closed even if I use

        xProps[0] = new PropertyValue();
        xProps[0].Name = "Asynchron";
        xProps[0].Value = Boolean.FALSE;

        Object oDispatch = xDispatch.executeDispatch(xProvider, ".uno:ClosePreview"l, 
"", 0, xProps);

It's not guaranteed that such parameter will be supported by this dispatch. It depends from it's internal implementation. On the other side I do not know if this dispatch is realy asynchron internaly. It's not a must.

BTW: Most of our ".uno:" dispatch implementations support that parameter ... but might be not this special one .-)

Dispatches "can be" asynchron or synchron !
The dispatch API should be used in cases only, where a result of an operation is not realy needed. The intention of these API was a smal l binding between a generic UI and the core API (based on URL's) - nothing more. Normaly a menu or toolbar entry has not to deal with the result of such dispatch request !

Next possible solutions:

a)
close these preview using another API

b)
use XNotifyingDispatch in combination with a XDispatchResultListener.
But note:
This interface is an optional one. If the returned dispatch object does not support it ... it's not usable .-) In case these interface will be supported you can provide a listener there. These listener must be called by the dispatch object if the internal operation was finished (normaly that means if the preview was clsoed - even if it was executed asynchronous). But you have to wait for this notification, The return of the dispatch call is not enough !

If b) does not work only a) can solve your problem.


Oliver
- --

Best Regards
Andreas

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

Reply via email to