Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Inplace Excel
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Inplace Excel

 Post Reply Post Reply
Author
Message
decembler View Drop Down
Groupie
Groupie
Avatar

Joined: 09 March 2006
Location: Germany
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote decembler Quote  Post ReplyReply Direct Link To This Post Topic: Inplace Excel
    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?
 
 
Back to Top
decembler View Drop Down
Groupie
Groupie
Avatar

Joined: 09 March 2006
Location: Germany
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote decembler Quote  Post ReplyReply Direct Link To This Post Posted: 17 March 2009 at 8:06am
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...
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2009 at 9:00am
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
Back to Top
decembler View Drop Down
Groupie
Groupie
Avatar

Joined: 09 March 2006
Location: Germany
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote decembler Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2009 at 9:54am
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)...
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2009 at 2:15am
Hello,
 
Thanks, agree this one with SkinFramework :(  Checking what can be done.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
decembler View Drop Down
Groupie
Groupie
Avatar

Joined: 09 March 2006
Location: Germany
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote decembler Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2009 at 4:18am
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

Back to Top
mxmauro View Drop Down
Newbie
Newbie


Joined: 24 March 2009
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote mxmauro Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2009 at 11:17am
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);
}
Back to Top
decembler View Drop Down
Groupie
Groupie
Avatar

Joined: 09 March 2006
Location: Germany
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote decembler Quote  Post ReplyReply Direct Link To This Post Posted: 27 March 2009 at 5:03am
Thanks a lot, it works perfect ...
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.064 seconds.