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

CXTPRibbonBar display issues

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CXTPRibbonBar display issues
    Posted: 21 June 2008 at 3:29pm
I posted a question before about having more than one ribbon causing problems. I have modified the RibbonMDISample sample to show these problems.
 
The issue I have is the old "MFC" caption and/or window icons displaying on top of the CodeJock ribbon.
 
To show the ribbon problems, I modified the sample to create and then delete a second ribbon. Make the same modifications (I will upload the modified mainfrm.cpp file) and build the sample.
 
Then again I can't upload since I am not a "registered forum member". I'll insert the code changes below.
 
Then start the sample. Neither the frame nor the mdi child created will be maximized. Move the cursor from the mdi client area and over the status bar crossing over the "NUM" section and onto the resize gripper at the lower right of the frame. When the mouse moves over the gripper, the MFC minimize, maximize and close icons will display over the top of the CJ frame's corresponding icons. That is the first problem.
 
Now set up your desktop with the sample frame and another window like the dos prompt such that the two windows don't intersect. With the sample being the active app, move the cursor to the dos prompt window and click it to activate it. Now move the cursor back to the sample app and click it. At this time, the entire MFC caption displays over the top of the CJ frame.
 
Performing other operations also can cause the MFC display overlay to occur. Sometimes it remains and sometimes it just flashes and the CJ ribbon overdisplays it. For instance, maximize and restore the mdi child window a few times. Notice the MFC overdisplay on the child window as it dynamically sizes up or down.
 
Or maximize the mdi child and grab the frame's resize gripper and dynamically resize the frame. Notice the light show at the top of the frame window as the MFC caption and icons and the CJ ribbon fight it out for display supremacy.
 
I really need to be able to allow the creation of more than one ribbon and would like to find a fix to this. I am not asking CJ to provide a fix in 11.2, which is our current version. If there is anything I can do to avoid the problem in our code I will gladly make changes.
 
Just in case the upload fails:
 
In MainFrm.h, find the definition of CreateRibbonbar and modify it to be:
 
BOOL CreateRibbonBar(bool bSecond);
 
In CMainFrame::OnCreate, add this right before the return statement:
 

if (!CreateRibbonBar(true))

{

TRACE0("Failed to create ribbon\n");

return -1;

}

Then replace the CreateRibbonBar function with this modified code:
 

BOOL CMainFrame::CreateRibbonBar(bool bSecond)

{

CMenu menu;

if( bSecond )

{

CRuntimeClass* pCommandBarsClass = RUNTIME_CLASS(CXTPCommandBars);

m_pCommandBars = (CXTPCommandBars*) pCommandBarsClass->CreateObject();

// fail to set the site and we crash.

m_pCommandBars->SetSite(this);

// set the ribbon theme

m_pCommandBars->SetTheme(xtpThemeRibbon);

}

else

{

menu.Attach(::GetMenu(m_hWnd));

SetMenu(NULL);

}

CXTPCommandBars* pCommandBars = bSecond ? m_pCommandBars : GetCommandBars();

 

#ifndef CREATE_FROM_XML

CXTPRibbonBar* pRibbonBar;

if( bSecond )

{

pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarFloating, RUNTIME_CLASS(CXTPRibbonBar));

m_pRibbonBar = pRibbonBar;

// If I don't set visible to false, and for some reason the m_pCommandBars is not destroyed when I release it below,

// the ribbon will display! So failsafe by setting visibility to false.

// Skip this call and the ribbon displays at the top left of the desktop.

m_pRibbonBar->SetVisible(FALSE);

m_pRibbonBar->EnableFrameTheme();

}

else

{

pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));

pRibbonBar->EnableDocking(0);

CXTPControlPopup* pControlFile = (CXTPControlPopup*)pRibbonBar->AddSystemButton(0);

pControlFile->SetCommandBar(menu.GetSubMenu(0));

pControlFile->SetIconId(IDB_GEAR);

}

if (!pRibbonBar)

{

return FALSE;

}

CXTPRibbonTab* pTabHome = pRibbonBar->AddTab(ID_TAB_HOME);

CXTPRibbonGroup* pGroupFile = pTabHome->AddGroup(ID_GROUP_FILE);

pGroupFile->Add(xtpControlButton, ID_FILE_NEW);

pGroupFile->Add(xtpControlButton, ID_FILE_OPEN);

pGroupFile->Add(xtpControlButton, ID_FILE_CLOSE);

CXTPControlPopup* pControlSave = (CXTPControlPopup*)pGroupFile->Add(xtpControlSplitButtonPopup, ID_FILE_SAVE);

pControlSave->GetCommandBar()->GetControls()->Add(xtpControlButton, ID_FILE_SAVE);

pControlSave->GetCommandBar()->GetControls()->Add(xtpControlButton, ID_FILE_SAVE_AS);

CXTPControlPopup* pControlPrint = (CXTPControlPopup*)pGroupFile->Add(xtpControlSplitButtonPopup, ID_FILE_PRINT);

pControlPrint->GetCommandBar()->GetControls()->Add(xtpControlButton, ID_FILE_PRINT);

pControlPrint->GetCommandBar()->GetControls()->Add(xtpControlButton, ID_FILE_PRINT_SETUP);

pControlPrint->SetBeginGroup(TRUE);

 

CXTPRibbonTab* pTabEdit = pRibbonBar->AddTab(ID_TAB_EDIT);

 

CXTPRibbonGroup* pGroupClipborad = pTabEdit->AddGroup(ID_GROUP_CLIPBOARD);

pGroupClipborad->ShowOptionButton();

CXTPControlPopup* pControlPaste = (CXTPControlPopup*)pGroupClipborad->Add(xtpControlSplitButtonPopup, ID_EDIT_PASTE);

pControlPaste->GetCommandBar()->GetControls()->Add(xtpControlButton, ID_EDIT_PASTE);

pControlPaste->GetCommandBar()->GetControls()->Add(xtpControlButton, ID_EDIT_PASTE_SPECIAL);

pGroupClipborad->Add(xtpControlButton, ID_EDIT_CUT);

pGroupClipborad->Add(xtpControlButton, ID_EDIT_COPY);

pGroupClipborad->Add(xtpControlButton, ID_FORMAT_PAINTER);

CXTPRibbonGroup* pGroupEditing = pTabEdit->AddGroup(ID_GROUP_EDITING);

pGroupEditing->Add(xtpControlButton, ID_EDIT_FIND);

pGroupEditing->Add(xtpControlButton, ID_EDIT_REPLACE);

pGroupEditing->Add(xtpControlButton, ID_EDIT_GOTO);

CXTPControlPopup* pControlSelect = (CXTPControlPopup*)pGroupEditing->Add(xtpControlPopup, ID_EDIT_SELECT);

pControlSelect->GetCommandBar()->GetControls()->Add(xtpControlButton, ID_EDIT_SELECT_ALL);

pControlSelect->SetFlags(xtpFlagManualUpdate);

CXTPRibbonTab* pTabView = pRibbonBar->AddTab(ID_TAB_VIEW);

CXTPRibbonGroup* pGroupDocumentView = pTabView->AddGroup(ID_GROUP_DOCUMENTVIEWS);

pGroupDocumentView->Add(xtpControlButton, ID_VIEW_NORMAL);

pGroupDocumentView->Add(xtpControlButton, ID_FILE_PRINT_PREVIEW);

pGroupDocumentView->Add(xtpControlButton, ID_VIEW_FULLSCREEN);

CXTPRibbonGroup* pGroupShowHide = pTabView->AddGroup(ID_GROUP_SHOWHIDE);

pGroupShowHide->Add(xtpControlCheckBox, ID_VIEW_STATUS_BAR);

pGroupShowHide->Add(xtpControlCheckBox, ID_VIEW_WORKSPACE);

CXTPRibbonGroup* pGroupWindow = pTabView->AddGroup(ID_GROUP_WINDOW);

pGroupWindow->Add(xtpControlButton, ID_WINDOW_NEW);

pGroupWindow->Add(xtpControlButton, ID_WINDOW_ARRANGE);

CXTPControlPopup* pControlSwitchWindows = (CXTPControlPopup*)pGroupWindow->Add(xtpControlPopup, ID_WINDOW_SWITCH);

pControlSwitchWindows->GetCommandBar()->GetControls()->Add(xtpControlButton, XTP_ID_WINDOWLIST);

 

CXTPControl* pControlAbout = pRibbonBar->GetControls()->Add(xtpControlButton, ID_APP_ABOUT);

pControlAbout->SetFlags(xtpFlagRightAlign);

pRibbonBar->GetQuickAccessControls()->Add(xtpControlButton, ID_FILE_SAVE);

pRibbonBar->GetQuickAccessControls()->Add(xtpControlButton, ID_EDIT_UNDO);

pRibbonBar->GetQuickAccessControls()->Add(xtpControlButton, ID_FILE_PRINT);

pRibbonBar->GetQuickAccessControls()->CreateOriginalControls();

#else

CXTPPropExchangeXMLNode px(TRUE, 0, _T("Settings"));

if (px.LoadFromResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_LAYOUT), RT_HTML))

{

CXTPPropExchangeSection pxCommandBars(px.GetSection(_T("CommandBars")));

XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;

param.bSerializeControls = TRUE;

GetCommandBars()->DoPropExchange(&pxCommandBars, &param);

}

else

{

AfxMessageBox(_T("Can't load Layout"));

return FALSE;

}

CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)GetCommandBars()->GetMenuBar();

pRibbonBar->EnableCustomization(FALSE);

pRibbonBar->GetQuickAccessControls()->SetOriginalControls(new CXTPOriginalControls());

pRibbonBar->GetQuickAccessControls()->GetOriginalControls()->Add(xtpControlButton, ID_FILE_SAVE);

pRibbonBar->GetQuickAccessControls()->GetOriginalControls()->Add(xtpControlButton, ID_EDIT_UNDO);

pRibbonBar->GetQuickAccessControls()->GetOriginalControls()->Add(xtpControlButton, ID_FILE_PRINT);

#endif

 

pRibbonBar->EnableFrameTheme();

// After the frame displays it should be that you have the sample frame window up with one mdi child. Neither

// the frame nor the child is maximized. Move the cursor down towards the status bar to use the gripper in the

// lower right to resize the frame and cross over the "NUM" area and onto the gripper. At this point, the old

// caption bar's minmize, maximize and close icons display over the CJ icons.

// Keep a dos window on the desktop and make sure the sample frame and dos window do not intersect. Now move

// the cursor onto the dos window and click to activate. Then move the cursor back to the sample and click

// it to activate it. At this point, the entire CJ title and icon area is completly overdrawn by the old mfc

// caption and icon stuff. You don't have to use a dos window, any window that doesn't intersect the sample

// app that is activated followed by activating the sample will show the problem.

// I tried not setting the frame to be the site but CJ will crash if I don't. I found code in CJ that called

// GetSite() and tested the result before using it. But a few lines later there was a GetSite()->SomeCall().

// Perhaps I can set another site but what would I use?

if( bSecond )

{

// Set a break here and skip the following code. Then examine the frame window. It has two title and icon

// rows. But the old style caption and icons don't display.

pCommandBars->InternalRelease();

// should have been the only ref on the object.

pCommandBars = NULL;

}

return TRUE;

}

 
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: 22 June 2008 at 2:34am
Hi,
 
you can download 11.2.2, check what lines was changed and include it to your 11.2 release.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 867
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2008 at 11:58am

There are a lot of changes. Can you narrow it down a bit?

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.234 seconds.