Print Page | Close Window

Missing maximize button on ribbon bar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4779
Printed Date: 09 May 2024 at 12:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Missing maximize button on ribbon bar
Posted By: Nick Burger
Subject: Missing maximize button on ribbon bar
Date Posted: 11 August 2006 at 11:27am
When creating a ribbon bar in our MDI application the maximize button of the frame window is missing when the window  is in it's restored state.
Whe maximized the restore button is visible.

 

Any ideas?

greetings from germany
Nick




Replies:
Posted By: Oleg
Date Posted: 14 August 2006 at 7:59am
Hi,
Do you have same problem with our sample?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 14 August 2006 at 9:27am
Have to check it with you samples, but it worked with XTP 9.7!


Posted By: Oleg
Date Posted: 14 August 2006 at 9:43am

So what versions of what components you use?



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 14 August 2006 at 10:06am
Xtreme ToolkitPro 10.3
 
MDI Applikation. MainFrame Class derived from CXTPMDIFrameWnd.
 
In OnCreate:
 
  CXTPCommandBars* pCommandBars = GetCommandBars();

  m_wndMenuBar = pCommandBars->SetMenu(csTitle, IDR_MAINFRAME);
  m_wndMenuBar->EnableCustomization(FALSE);
  m_wndMenuBar->EnableDocking(xtpFlagAlignTop);
  m_wndMenuBar->SetFlags(xtpFlagHideMinimizeBox|xtpFlagHideMaximizeBox|xtpFlagHideClose, 0);
  m_wndMenuBar->SetFlags(xtpFlagStretched, 1);
    /* other init code */   
    OnReloadMenuBar();
   
   
    MainFrame::OnReleadMenuBar()
    {
        CMenu* pMenu = NULL;
      VARIANT_BOOL vbDatabaseIsOpen;
      m_spDatabaseManager->IsDatabaseOpen(&vbDatabaseIsOpen);
      if(vbDatabaseIsOpen == VARIANT_TRUE)
      {
        m_LongMenu.DestroyMenu();
        m_LongMenu.LoadMenu(IDR_MUITYPE);
        pMenu = &m_LongMenu;
      }
      else
      {
        m_ShortMenu.DestroyMenu();
        m_ShortMenu.LoadMenu(IDR_MAINFRAME);
        pMenu = &m_ShortMenu;
      }
     
    m_Coolmenu.LoadMenu(pMenu);
  }

  m_Coolmenu has a pointer to m_wndMenuBar and calls LoadMenu on m_wndMenuBar.
 




Posted By: Oleg
Date Posted: 14 August 2006 at 11:15am
Hi,
Strange.. it looks like you use Ribbon instead MenuBar?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 15 August 2006 at 3:46am
"looks like you use Ribbon instead MenuBar" Great hint .
There was a line of code left over from a ribbon test.
ThanX.

But when I remove all menu and toolbar code, and create a ribbon bar, I'll get this bahavior too.


  pCommandBars->SetPaintManager(new CXTPRibbonTheme());
  /* ...... */
  if (!CreateRibbonBar())
  {
    TRACE0("Failed to create ribbon\n");
    return -1;
  }

/* ------- */

BOOL CMainFrame::CreateRibbonBar()
{
  CXTPCommandBars* pCommandBars = GetCommandBars();

  SetMenu(NULL);

  CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));
  if (!pRibbonBar)
  {
    return FALSE;
  }

  pRibbonBar->EnableDocking(0);
  pRibbonBar->SetFlags(xtpFlagHideMDIButtons, 0);
//   pRibbonBar->SetFlags(xtpFlagStretched, 1);


  CXTPControlPopup* pControlFile = (CXTPControlPopup*)pRibbonBar->AddSystemButton();
  pControlFile->SetCommandBar(m_LongMenu.GetSubMenu(0));
  pControlFile->SetCaption(_T("&File"));

  pControlFile->SetIconId(IDB_GEAR);
  UINT uCommand = {IDB_GEAR};
  pCommandBars->GetImageManager()->SetIcons(IDB_GEAR, &uCommand, 1, xtpImageNormal);

  CXTPRibbonTab* pTab = pRibbonBar->AddTab(IDR_EDIT_TOOLBAR);
  CXTPRibbonGroup* pGroupView = pTab->AddGroup(IDS_STATICVIEWTEXT);
  pGroupView->Add(xtpControlButton, ID_EDIT_SINGLELETTER);
  pGroupView->Add(xtpControlButton, ID_EDIT_BUILD_HIERARCHY);
  pGroupView->Add(xtpControlButton, ID_VIEW_CHOOSE_VIEW_DIALOG);
  pGroupView->Add(xtpControlButton, ID_FORMAT_STATISTIK);
  pGroupView->Add(xtpControlButton, ID_QUERY_QBE);

  pRibbonBar->SetCloseable(FALSE);
  pRibbonBar->EnableFrameTheme();

  return TRUE;
}

What could probably be wrong?


Posted By: Oleg
Date Posted: 15 August 2006 at 10:13am
Hi,
Code looks good. Cna you attach whole project? May be you just forget to add this button image or something.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 16 August 2006 at 4:16am
I tried the following code (in CMainFrame::OnCreate):

  pCommandBars->SetTheme(xtpThemeRibbon);
  HMODULE hModule = LoadLibrary(m_csStylesPath + _T("Office2007Blue.dll"));
  ((CXTPOffice2007Theme*)GetCommandBars()->GetPaintManager())->SetImageHandle(hModule);

and copied the style folder from your samples. But still the same problem.


        if (pControl->GetID() == SC_MAXIMIZE)
        {
            pControl->SetHideFlag(xtpHideGeneric, (dwStyle & WS_MAXIMIZE) || ((dwStyle & WS_MAXIMIZEBOX) == 0));
        }
        if (pControl->GetID() == SC_RESTORE)
        {
            pControl->SetHideFlag(xtpHideGeneric, !(dwStyle & WS_MAXIMIZE) || ((dwStyle & WS_MAXIMIZEBOX) == 0));
        }

in CXTPOffice2007FrameHook is called with dwStyle = 0x168f8000 whe frame window is'nt maximized.

Am I right, that I do not have to add any bitmaps to may project, when using SetImageHandle() on PaintManager?
 


Posted By: Oleg
Date Posted: 16 August 2006 at 11:27am
Nick, I need debug your code... May be you just remove WS_MAXIMIZEBOX style from frame...

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 17 August 2006 at 7:22am
dwStyle = 0x168f8000 means, as I assume , that bit 0x00010000 is set, which is WS_MAXIMIZEBOX.

0x168f8000
0x00010000

It works without RibbonBar. Either the bitmaps for MaximizeBox are missing for some reason, or visibility of MaximizeBox is turned off from any other place and reason, which I don't know and have to find.



Posted By: Oleg
Date Posted: 17 August 2006 at 7:45am

Hi,

Nick, I don't see way to help you without debugging your code.... If project not so big, create new issue and attach it, I will help you to find problem... Or try manually set breakpoint in if (pControl->GetID() == SC_MAXIMIZE) block and check if HideFlag == 0.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 17 August 2006 at 9:14am
"manually set breakpoint in if (pControl->GetID() == SC_MAXIMIZE) block and check if HideFlag == 0."
Already did that. HideFlag is definitly 0.
Project is much too big plus depends on tons of other COM-modules.

I understand that you need to know more about the code to help.
Will try to debug the thing.
Where will I find the code which actually draws the maximizebox?
PaintManager?



Posted By: Oleg
Date Posted: 17 August 2006 at 9:46am
Hi,
 
Set breakpoint in
 
void CXTPOffice2007Theme::DrawRibbonFrameCaptionButton(CDC* pDC, CRect rc, int nId, BOOL bSelected, BOOL bPressed, BOOL bActive)


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 21 August 2006 at 7:46am
Set the breakpoint, but code is never called for (nId == SC_MAXIMIZE).

In xtpribbonbar.cpp line: 1207 you loop through all control buttons.
pControl->IsVisible() return false for Maximize-Control. In CXTPOffice2007FrameHook::RepositionCaptionButtons HideFlag for SC_MAXIMIZE is set to 0.
Looks to me like I have two different CXTPControl buttons with m_nID == SC_MAXIMIZE. On is set to visible, but the other should be drawn.

Any other idea where I can look/debug to find the problem?



Posted By: Oleg
Date Posted: 21 August 2006 at 8:46am
Hi,
 
btw... check your resource.h may be you have some id that is
equal to SC_MAXIMIZE
 
 
SC_MAXIMIZE  = 0xF030 = 61488
?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 21 August 2006 at 9:28am
cool!  That was the problem.

Which ID range do you use for XtremeToolkit Pro?




Posted By: Oleg
Date Posted: 21 August 2006 at 10:19am
Hi,
 
Actually tooolkit's resources from 9000 to 10000...
but this is MFC/OS resource.
 
so better use range from 100 to 9000


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Nick Burger
Date Posted: 21 August 2006 at 10:40am
You should see our ResourceId's. It's a project grown through the last 12 years. It was once a 16 bit version. If you want to knwo what evolution means, this is an extraordinary example .




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net