Hey, thanks

I'm not very used to working with proxies.

Some new info about my issue here has come to light.  It would seem that
both your suggested approaches work occasionally.  That is, both only works
in debug mode.  Which makes me assume that it is a Threading issue.
However attempting to control the sequence of the Threads doesn't work at
all.  For example:

public void layoutEvent(EventObject eventObject, short i, Object object) {
        if (i == LayoutManagerEvents.UIELEMENT_VISIBLE &&
object.equals("private:resource/menubar/menubar")) {
                SwingUtilities.invokeLater(new Runnable(){

                    public void run() {
                        try {
                            addParagraafMenu();
                        } catch (Exception e) {
                            throw new
SeriousException(e.getMessage(),this,e);
                        }
                    }
                });

            }
        }



Carsten Driesner wrote:
> 
> Fhomasp wrote:
>> Hey, and thanks! :)
>>
>> You mean an XLayoutManagerEventBroadcaster I assume?
>> I can't say I found many examples of an XLayoutManagerEventBroadcaster. 
>> And
>> I'm not sure where and which listener I need to attach.
>>   
> Hi Fhomasp,
> 
> This is trivial if you look at the interface declaration of 
> com.sun.star.frame.XLayoutManagerEventBroadcaster. You need to implement 
> the interface com.sun.star.frame.XLayoutManagerListener. It contains 
> just on method called:
> 
> void layoutEvent( [in] com::sun::star::lang::EventObject aSource, [in] 
> short eLayoutEvent, [in] any aInfo );
> 
> As your code already retrieves the LayoutManager from the frame it's 
> fairly simple to query for 
> com.sun.star.frame.XLayoutManagerEventBroadcaster and call 
> addLayoutManagerEventListener( yourlistenerinstance ).
> 
> In your implementation for layoutEvent(...) you should first look for 
> the interesting eLayoutEvent called UIELEMENT_VISIBLE. The aInfo 
> parameter contains the resource url of the user interface element. E.g. 
> for your use case this is "private:resource/menubar/menubar". So if you 
> receive an event with eLayoutEvent == UIELEMENT_VISIBLE and aInfo == 
> "private:resource/menubar/menubar" than you should use the source (which 
> is the LayoutManager) to query for the menu bar. If the menu bar needs 
> to be changed you should call your configuration code.
> 
> Regards,
> Carsten
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/custom-menu-item-disappearing-after-printpreview-tp22741195p22800525.html
Sent from the openoffice - dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to