Tobias Krais wrote:
> Hi again,
>
>> I think the COMPONENT_REATTACHED is the proper
place to change the menus
>> again.
>
> well, this is not the right place to redo the changes:
at the time this
> event is fired, I cannot retrieve the menubar, it is
null. When changing
> to the page view I can perform the changes when the
CONTEXT_CHANGED
> event is fired and this works well.
>
> But going back to normal view, as I wrote the events
CONTEXT_CHANGED,
> then COMPONENT_DETACHING and COMPONENT_REATTACHED are
fired. I can
> perform the the changes when the CONTEXT_CHANGED event
is fired, but
> that won't help, because the component is detached soon
and the changes
> are lost. Thus I want to perform the changes when the
last event is
> fired: COMPONENT_REATTACHED. But again, I cannot
retrieve the menu bar,
> because at that time it is null.
>
> Is the XFrameActionListener really the right listener?
Is there an other
> listener telling me about the proper events?
Hi Tobias,
Yes, the XFrameActionListener is the correct listener. There
is only a
problem with the order of notification. The layout manager
which
controls the user interface elements is also
XFrameActionListener. It
looks like that the layout manager is notified after you get
your
notification. You can solve the problem using the
com.sun.star.frame.XLayoutManagerListener. The layout
manager implements
the interface
com.sun.star.frame.XLayoutManagerEventBroadcaster which
you have to use to add your listener. You can find the
notifications in
com.sun.star.frame.LayoutManagerEvents. Use the
UIELEMENT_VISIBLE
notification and the name of the user interface element:
"private:resource/menubar/menubar". Whenever you
get
COMPONENT_REATTACHED you should wait for the
UIELEMENT_VISIBLE
notification and then you change the menu bar.
Regards,
Carsten
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|