![]() |
Inplace Excel |
Post Reply ![]() |
Author | |
decembler ![]() Groupie ![]() ![]() Joined: 09 March 2006 Location: Germany Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() Posted: 12 March 2009 at 4:01am |
Hello together,
I developed a MDI application which has an Excel Sheet in placed the view.
If I do this with a standard MFC MDI application everything works fine.
If I do this with a XTP extended MDI application the menu of the in placed
Excel is incomplete, the most entries are disabled, the menu entry 'File' is
missing complete and if I close the child frame, the menu don't change to
the standard IDR_MAINFRAME menu.
Is there anyone who has experience with implement menus from in place
servers in the XTP framework?
|
|
![]() |
|
decembler ![]() Groupie ![]() ![]() Joined: 09 March 2006 Location: Germany Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() |
Hello again,
perhaps you need a bit more information and the sample code.
I develop with the XTP version 12.1.1 VS6 SP6 OS XP SP2.
I attach two projects both created with the Application Wizzard, one standard and one with the
XTP template (two more steps). I modified the CtrlItem class and the View class in both, so that at
the start Excel will be loaded inplace. In the standardproject everthing works fine in the XTP project
the Excel menu is visible but all items are disabled. The strange thing is, if I modify the OnSetMenu
function of the CtrlItem an set the menu of the main frame in the old style I will get two menus and
the new one will work.
void CTstConCntrItem::OnSetMenu(CMenu* pMenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
{ COleClientItem::OnSetMenu(pMenuShared, holemenu, hwndActiveObject); // uncomment this line and the new menu will work
// thisMainFrm.SetMenu(pMenuShared); } Any ideas...
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
You have to hide our Menu and show standard for Execl view.
See code in Samples\PropertyGrid\DrawClient\cntritem.cpp
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
decembler ![]() Groupie ![]() ![]() Joined: 09 March 2006 Location: Germany Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() |
Thank's oleg for this hint, but this works only without a skin.
If I load a skin via XTPSkinManager()->LoadSkin I can see the menu,
but the submenus didn't work. If i use the style
XTPSkinManager()->SetApplyOptions(xtpSkinApplyFrame|xtpSkinApplyColors|xtpSkinApplyMetrics|xtpSkinApplyMenus);
the submenus become visible but didn't work.
Thomas
This works
![]() This menu don't work (nothing happens if you select a item)...
![]() |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
Thanks, agree this one with SkinFramework :( Checking what can be done.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
decembler ![]() Groupie ![]() ![]() Joined: 09 March 2006 Location: Germany Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() |
Thanks again for your support.
I found another hint. It's not a really a workaround, because on some menu commands
(eg Edit-Delete-All) Excel crashes in the background, but the most commands woks fine.
I implement the WindowProc function in my CMainFrame class like this
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{ if(message == WM_COMMAND) { CMDIChildWnd* pChild = (CMDIChildWnd*)GetActiveFrame(); if(pChild) { CView* pView = pChild->GetActiveView();
ASSERT_VALID(pView);
// dispatch the WM_COMMAND messages to the Excel inplace if(pView->IsKindOf(RUNTIME_CLASS(CExcelView))) ::PostMessage(((CExcelView*)pView)->GetInplaceWnd(), message, wParam, lParam); }
}
return CMDIFrameWnd::WindowProc(message, wParam, lParam);
} Perhaps this could help you...Thomas
|
|
![]() |
|
mxmauro ![]() Newbie ![]() Joined: 24 March 2009 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
If you remove the call to HandleSysCommand inside CXTPSkinObjectFrame::OnSysCommand (e.g. replacing with assembly code to NOPs)... you can access the menu by pressing alt (you will see it in a wrong place), but the menu will work again.
I'm almost sure that the problem is somewhere in CXTPSkinObjectApplicationFrame::HandleSysCommand menu handling.
EDIT:
Temporaly fix based on decembler code:
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_MENURBUTTONUP:
case WM_MENUDRAG:
case WM_MENUGETOBJECT:
case WM_MENUCOMMAND:
case WM_MEASUREITEM:
case WM_DRAWITEM:
case WM_ENTERMENULOOP:
case WM_INITMENU:
case WM_MENUSELECT:
case WM_INITMENUPOPUP:
case WM_UNINITMENUPOPUP:
case WM_COMMAND: case WM_EXITMENULOOP: case WM_MENUCHAR: case WM_ENTERIDLE: { CMDIChildWnd *lpChildWnd; CView *lpView;
COleClientItem *lpItem;
CWnd *lpWnd;
CDocument *lpDoc;
lpChildWnd = (CMDIChildWnd*)GetActiveFrame();
if (lpChildWnd!=NULL && lpChildWnd->IsKindOf(RUNTIME_CLASS(CWinWordMDIChildWnd))) {
lpView = lpChildWnd->GetActiveView();
if (lpView!=NULL && lpView->IsKindOf(RUNTIME_CLASS(CWinWordView))!=FALSE) {
lpDoc = lpView->GetDocument();
if (lpDoc!=NULL && lpDoc->IsKindOf(RUNTIME_CLASS(CWinWordDoc))!=FALSE) {
lpItem = ((CWinWordDoc*)lpDoc)->GetPrimarySelectedItem(lpView);
if (lpItem!=NULL && lpItem->IsKindOf(RUNTIME_CLASS(CWinWordCntrItem))!=FALSE) {
lpWnd = lpItem->GetInPlaceWindow();
if (lpWnd != NULL)
return lpWnd->SendMessage(message, wParam, lParam);
}
}
}
}
}
break;
}
return CMDIFrameWnd::WindowProc(message, wParam, lParam);
}
|
|
![]() |
|
decembler ![]() Groupie ![]() ![]() Joined: 09 March 2006 Location: Germany Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() |
Thanks a lot, it works perfect
![]() |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |