Print Page | Close Window

CXTPMenuBar and Minimize/Maximize buttons

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=897
Printed Date: 25 April 2024 at 2:56pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPMenuBar and Minimize/Maximize buttons
Posted By: yoavo
Subject: CXTPMenuBar and Minimize/Maximize buttons
Date Posted: 29 June 2004 at 6:11am

Hi,

In my MDI application I create my menu dynamically (not loading from resources). I wrote a method that recieves a CMenu object and attached it to an existing CXTPMenuBar object. In general it work ok, but I have the following problem: If the view is maximized (in this case the CXTPMenuBar is added with the minimize/maximize box buttons), and then I use my replacing menu method, the 3 buttons disappearing, and I get them back only if I float the CXTPMenuBar and dock it again.

This is my code for replacing the menu:

void CMainFrame::CreateXTPMenu(CMenu* iMenu)
{
 CXTPCommandBars* pCommandBar;
 CXTPMenuBar*   pMenuBar;
 pCommandBar = GetCommandBars();
 pMenuBar = pCommandBar->GetMenuBar();
 pMenuBar->LoadMenu(iMenu);
}

I tried to add at the end:

 RecalcLayout(FALSE);
 GetCommandBars()->RedrawCommandBars();
 RedrawWindow();

But it didnt help.

Yoav.


 




Replies:
Posted By: yoavo
Date Posted: 12 July 2004 at 8:51am

I figure out how to refresh the SysButtons. There is a method in CXTPMenuBar::RefreshMenu which do the job. Unfortunattely it is not public, so the only way for me is to send a WM_TIMER message which call "RefreshMenu". The identifier of the timer (TID_REFRESH) is define in the .cpp file.

This is my code:

pMenuBar->LoadMenu(iMenu);

pMenuBar->PostMessage(WM_TIMER,12223,0);

Can I do it more elegant ?

Yoav.



Posted By: vlad
Date Posted: 11 February 2005 at 1:25pm

I have a similar problem. When I create MDI child window manually, and maximize it afterwards, MDI menu buttons disappear. I think it's a bug related to CXTPMenuBar not handling the WM_MDIREFRESHMENU message. It can be fixed by adding another "case" statement into the CXTPMenuBar::OnHookMessage function before compiling the toolkit libs and dlls. Here is the code (XTPMenuBar.cpp, line:480):

case WM_MDIREFRESHMENU:
     #ifdef _XTP_DOTNET
           PostMessage( WM_TIMER, TID_REFRESH, 0 );
     #else
           RefreshMenu();
     #endif
     wParam = 0; 
     return TRUE;



Posted By: Oleg
Date Posted: 17 February 2005 at 1:01am
In 9.60 RefreshMenu method is public.

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



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