List Info

Thread: Re: Transient menu changes are too transient




Re: Transient menu changes are too transient
user name
2007-09-19 01:25:44
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-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Transient menu changes are too transient
user name
2007-09-20 09:57:38
Hi Carsten

> 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.

I solved it this way: I registered a XLayoutManagerListener,
as you
adivsed. I do not receive a UIELEMENT_VISIBLE event, but a
LAYOUT_EVENT
(event number 2). When this event is fired, I first check if
the menu
items already exist. If not they are added again.

Thank you for your help!

Greetings, Tobias

P.S.: Thank you for adding support of icons for transient
toolbar items
in OOo 2.3. I really appreciate this feature!

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


[1-2]

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