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.
Carsten Driesner wrote: > > Fhomasp wrote: >> Hey, >> >> Thanks for the info. >> >> I do seem to run into problems trying to get it to work adding a >> FrameActionListener. Here's what happens. >> >> 1. I add an anonymous implementation of XFrameActionListener to the frame >> when a document is loaded. >> When I catch the FrameAction: "FrameAction.COMPONENT_REATTACHED" only I >> catch the Action when PrintPreview is invoked. >> When I catch using if - else and use "FrameAction.COMPONENT_ATTACHED" >> then >> in the first "if", as described above, I can't catch an action when >> PrintPreview is invoked. >> >> 2. In any of the given situations I cannot seem to get a hold of the >> MenuBar. It's always null. I tried to get the XFrame in several ways, >> which works and then try to get the XLayoutManager using the XPropertySet >> from the different ways of getting the XFrame. I get "an" >> XLayoutManager, >> however it never has any Elements. I print out the Elements received >> from >> xLayoutManager.getElements(), but it's an empty Array. >> >> > Hi Fhomasp, > > That sounds strange as my code does the same and works without a > problem. Looks like that your listener is called before the layout > manager gets notified which would result in an empty user interface. > Therefore another approach is to use the LayoutManager notifications for > the user interface elements. Use the XLayoutManagerBroadcaster and add > your code as a listener. Whenever you receive a > css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE notification and the > aInfo parameter contains the resource URL of the menu bar, you can check > if you have to make your changes again. > > 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-tp22741195p22780221.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]
