OleClientSite Trouble with Excel [message #650630] |
Tue, 25 January 2011 18:58 |
|
Hello Everyone,
I am currently developing an Eclipse RCP App including an editor that has to embed an Excel application as in-place editor. I am using the OLE facilities from SWT. In detail I am using the OleControlSite referencing to a xls-file in order to open the Excel instance. In general things look fine but I am facing the following problems :
1. Looking to MSDN and other sources, I understand that if trigerring the doVerb(OLE.OLEIVERB_INPLACEACTIVATE) Excel should show up not messing around with the menus of the RCP until the user gives the focus to the Excel client. As soon as the client looses focus the RCP menus should get back to normal, but they don't. Is this a bug? Or is it just me not understanding some bits?
2. To overcome the first problem, I added a FocusListener to the OleControlSite, to do the doVerb(OLE.OLEIVERB_INPLACEACTIVATE) as soon as excel gets the focus, and to call deactivateInPlaceClient() as soon as it looses focus. Doing this I am fine with my RCP Menus and the Excel menus' mixins. Unfortunately now, calling the deactivateInPlaceClient(), will stop rendering the Excel application correctly and it just shows the "A1" cell stretched to the size of the OleFrame.
Does anyone know how to get around theses Issues. I am currently trying to activate and deactivate the Excel's "CommandBars" together with the FocusListener but firstly it is not a beautiful approach, secondly I don't even know if it will work.
Cheers
Phil
|
|
|
Re: OleClientSite Trouble with Excel [message #650756 is a reply to message #650630] |
Wed, 26 January 2011 12:35 |
|
Hi there,
DIgging through the code of OLE and eclipse if ound two moderate solutions to my Problem :
First Solution is:
Set the RCP's MenuBar to null by using getShell().setMenuBar(null) befor activating the oleControlSite. And after that set the MenuBar back to what it has been before. This prevents the OleFrame from doing anything with the RCP's MenuBar because it assumes it does not exist.
Second Solution is:
Use OS.SetMenu(shellHandle, menubar.handle); to set back the RCP's MenuBar.
Still this is a workaround, And I am not fully convinced with this solution. Anyway it works for the moment. Other Ideas and thoughts are still welcome.
Cheers
Phil
|
|
|
Powered by
FUDForum. Page generated in 0.03242 seconds