This is how the disappearing menuItem got fixed.


>     //the menubar we want is a property of the XUIElement oMenuBar
>                 XMenuBar bar = (XMenuBar)
> UnoRuntime.queryInterface(XMenuBar.class,
> menuBarProps.getPropertyValue("XMenuBar"));
> 
>                 XUIElementSettings xoMenuBarSettings =
> (XUIElementSettings) UnoRuntime
>                         .queryInterface(XUIElementSettings.class,
> oMenuBar);
>                 XIndexContainer oMenuBarSettings = (XIndexContainer)
> UnoRuntime
>                         .queryInterface(XIndexContainer.class,
> xoMenuBarSettings
>                                 .getSettings(true));
> 
>                 XSingleComponentFactory factory =
> (XSingleComponentFactory)
>                         UnoRuntime
>                                
> .queryInterface(XSingleComponentFactory.class,
>                                         oMenuBarSettings);
> 
>                 PropertyValue[] menu = createMenu(".uno:PickList","VAPH",
> factory);
>                 oMenuBarSettings.insertByIndex(0, menu);
> 
>                 XIndexContainer vaphContainer = (XIndexContainer)
> UnoRuntime.queryInterface(XIndexContainer.class, menu[3].Value);
> 
>                 PropertyValue[] subPv1 = createMenuItem(".uno:Print++",
> FENIKS_PRINT);
>                 PropertyValue[] paragraaf =
> createMenuItem(".uno:Paragraaf++","Optionele ~Paragrafen...");
> 
>                 vaphContainer.insertByIndex(0,subPv1);
>                 vaphContainer.insertByIndex(1,paragraaf);
> 
>                 xoMenuBarSettings.setSettings(oMenuBarSettings);
>                 XTopWindow topWindow = (XTopWindow)
> UnoRuntime.queryInterface(XTopWindow.class,
> xFrameWindow.getUNOWindowPeer());
> 
>                 //setting the new menubar
>                 topWindow.setMenuBar(bar);
>                 //not setting it persistent otherwise is will be added
> multiple times on every reload
>                 menuBarProps.setPropertyValue("Persistent", new
> Boolean(false)); 
> 
> 
>    private PropertyValue[] createMenuItem(String sMyCommand, String label)
> throws Exception {
>         PropertyValue[] loadProps = new PropertyValue[4];
>         loadProps[0] = new PropertyValue();
>         loadProps[1] = new PropertyValue();
>         loadProps[2] = new PropertyValue();
>         loadProps[3] = new PropertyValue();
> 
>         loadProps[0].Name = "CommandURL";
>         loadProps[0].Value = sMyCommand;
>         loadProps[1].Name = "Label";
>         loadProps[1].Value = label;
>         loadProps[2].Name = "Type";
>         loadProps[2].Value = 0;
>         loadProps[3].Name = "ItemDescriptorContainer";
>         loadProps[3].Value = null;
> 
>         return loadProps;
>     }
> 
> 




Carsten Driesner wrote:
> 
> Fhomasp wrote:
>> Hey,
>>
>> Alright, noted.  However I still need to get this to work.  At this point
>> it
>> seems that the LayoutManager lifecycle is already put into another
>> Thread. 
>> How else could it be that I can get it working slightly better with the
>> use
>> of Threads, and get 100% successrate if I wait long enough in Debug mode?
>> Still.  It's nowhere near a good solution, and I can't have the users go
>> through debug mode :-)
>>   
> Hi Fhomasp,
> 
> I don't know why you have these kind of problems as I cannot reproduce 
> it with my own implementation. I also know that the LayoutManager is 
> normally not running in a different thread. OpenOffice.org has just one 
> thread for the user interface called the main thread. It's possible to 
> call the LayoutManager from a different thread using remote UNO but I 
> cannot recommend it. The only thing I can propose to you is that you 
> send me your solution via mail and I will try to find out what's wrong. 
> As we are short before the release of OOo 3.1 I cannot promise that I 
> have time to check it in the next couple of days.
> 
> 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-tp22741195p22950787.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