Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Non-restoreable Ribbon-MDIs...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Non-restoreable Ribbon-MDIs...

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

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Non-restoreable Ribbon-MDIs...
    Posted: 01 July 2008 at 8:33am
I want my ribbon-MDIs to always be maximized. I solved this by overriding ActivateFrame() in my frame window, setting nCmdShow = SW_SHOWMAXIMIZED. Also, I added this in CMainFrame:

m_MTIClientWnd.ShowWorkspace(FALSE);
pCommandBars->GetMenuBar()->SetFlags(xtpFlagHideMinimizeBox | xtpFlagHideMaximizeBox);

I thought my MDIs were safe, but no... Alt+'-' causes a context menu to appear with the options "restore", "minimize" and "close". How do I prevent this menu from appearing?
 
Added image (WS_SYSMENU removed):
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: 01 July 2008 at 1:03pm
Hi,
 
Catch WM_SYSCOMMAND + SC_KEYMENU/SC_MOUSEMENU.
 
Or better remove these commands from SystemMenu. pWnd->GetSystemMenu()->etc.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2008 at 7:32pm
Please see image in original post!
 
The items are re-enabled by the framework. However, this works: 
cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
 
Though, the "Move" command is still available. I can live with that, but how would you delete the menu alltogether?
 
Note that removing WS_SYSMENU yields a menu with an empty menu item (bug in Toolkit or MFC?) when pressing Alt+'-'. I tried this in a new MFC-MDI-app and got a lockup instead... crazy.
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: 02 July 2008 at 1:10am
Hi,
I didn't write "disable" I wrote "remove" :-)
 
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
  return -1;
 
 CMenu* pMenu = GetSystemMenu(FALSE);
 pMenu->RemoveMenu(SC_RESTORE, MF_BYCOMMAND);
 pMenu->RemoveMenu(SC_MINIMIZE, MF_BYCOMMAND);
 pMenu->RemoveMenu(SC_MAXIMIZE, MF_BYCOMMAND);
 pMenu->RemoveMenu(SC_MOVE, MF_BYCOMMAND);
 pMenu->RemoveMenu(SC_SIZE, MF_BYCOMMAND);
 
 return 0;
}
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2008 at 10:06am

Did you try it? ;)

"Move" (with text this time) is still there after executing your code, even though all menu items have been removed. How is this possible?!
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: 02 July 2008 at 10:13am
Hi,
just tried with Ribbon MDI Sampe. Works.
Did you try? ;-)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2008 at 12:56am
Could my problem have something to do with my CXTPTabClientWnd in CMainFrame? I really can't get rid of the "Move" item!
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: 04 July 2008 at 1:28am
Hi,
 
Ribbon MDI sample also has it. Can you modify one of sample, reproduce problem and attach here?
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.172 seconds.