Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPMenuBar and Minimize/Maximize buttons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPMenuBar and Minimize/Maximize buttons

 Post Reply Post Reply
Author
Message
yoavo View Drop Down
Senior Member
Senior Member


Joined: 29 February 2004
Location: Israel
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote yoavo Quote  Post ReplyReply Direct Link To This Post Topic: CXTPMenuBar and Minimize/Maximize buttons
    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.


 

Back to Top
yoavo View Drop Down
Senior Member
Senior Member


Joined: 29 February 2004
Location: Israel
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote yoavo Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
vlad View Drop Down
Newbie
Newbie


Joined: 19 April 2004
Location: Canada
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote vlad Quote  Post ReplyReply Direct Link To This Post 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;



Edited by vlad
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: 17 February 2005 at 1:01am
In 9.60 RefreshMenu method is public.
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.156 seconds.