Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - EnableFrameTheme when CMainFrame is not main wnd
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

EnableFrameTheme when CMainFrame is not main wnd

 Post Reply Post Reply
Author
Message
Cyprien View Drop Down
Newbie
Newbie
Avatar

Joined: 27 June 2011
Location: France
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cyprien Quote  Post ReplyReply Direct Link To This Post Topic: EnableFrameTheme when CMainFrame is not main wnd
    Posted: 28 June 2011 at 8:46am
Hello,

The software I'm working on has a very particular configuration. The CXTPFrameWnd derived class is not the main window of the application. The CMainFrame window is in a COleControl, and the COleControl is in a CDialog. (This allow an ActiveX usage of CMainFrame). For the user it's just like if there where only a the main frame.
I can use a ribbon in my main frame, but when I call EnableFrameTheme, It does'nt work as expected :
The mainframe can be moved inside the main dialog !

I tried some modification in ToolkitPro sources in order to have CXTPRibbonBar::GetSite() and CXTPOffice2007FrameHook::m_hwndSite be the parent window of the application. It solves some problems but it's not enough : the maximize/minimize/close buttons don't work.

Can someone help me please ?

Thanks
Cyprien 
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: 29 June 2011 at 2:59am
So your dialog don't have frame/caption and you want that your child frame as replacement of dialog's ?

If you don't call EnableFrameTheme it works like you expected ?  

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Cyprien View Drop Down
Newbie
Newbie
Avatar

Joined: 27 June 2011
Location: France
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cyprien Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2011 at 3:30am
Hi Oleg,

My Dialog has a caption and borders, the main frame has no caption and no border.
If I don't call EnableFrameTheme I Can see the dialog caption and below the ribbon and it works as expected.

Here is a sample project I did yesterday which reproduces the problem
uploads/6868/RibbonFrameTheme.zip

When you click on EnableFrameTheme (in the ribbon) there are no visual changes but you can move the window containing the ribbon inside the dialog box.

The following modifications produces a better visual result but doesn't fully work :
In XTPCommandBar.h line 371 add virtual before CWnd* GetSite() const;
In XTPOffice2007FrameHook.cpp, CXTPOffice2007FrameHook::EnableOffice2007Frame(CXTPCommandBars* pCommandBars)
replace

  if (pCommandBars)
    {
#ifdef _XTP_INCLUDE_RIBBON
      m_pRibbonBar = DYNAMIC_DOWNCAST(CXTPRibbonBar, pCommandBars->GetMenuBar());
#endif
      m_hwndSite = pCommandBars->GetSite()->GetSafeHwnd();
  }


with

  if (pCommandBars)
  {
#ifdef _XTP_INCLUDE_RIBBON
    m_pRibbonBar = DYNAMIC_DOWNCAST(CXTPRibbonBar, pCommandBars->GetMenuBar());
#endif
    m_hwndSite = pCommandBars->GetSite()->GetSafeHwnd();
    if (m_hwndSite)
    {
      HWND hParent = GetParent(m_hwndSite);
      while (hParent)
      {
        m_hwndSite = hParent;
        hParent = GetParent(hParent);
      }
    }
  }

In CXTPRibbonBar, overload the virtual method virtual CWnd* GetSite() const; with

CWnd* CXTPRibbonBar::GetSite() const
{
  if (IsFrameThemeEnabled())
  {
    return m_pFrameHook->GetSite();
  }
  else
  {
    return __super::GetSite();
  }
}
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: 30 June 2011 at 2:33am
Hi,

For Child frames I don't recommend you such workarounds. Just don't call EnableFrameTheme.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.031 seconds.