Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Prevent menubar from moving.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Prevent menubar from moving.

 Post Reply Post Reply
Author
Message Reverse Sort Order
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 Topic: Prevent menubar from moving.
    Posted: 01 March 2005 at 11:55pm

pMenBar->EnableDocking(xtpFlagStretched);

PToolBar1->EnableDocking(xtpFlagHideWrap);

...

 

seems it will be easy ;)



Edited by oleg
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
larryp View Drop Down
Groupie
Groupie


Joined: 15 January 2005
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote larryp Quote  Post ReplyReply Direct Link To This Post Posted: 01 March 2005 at 7:34am
I figured out how to do it, so I will post the answer for someone who may need it in the future.

1) Create a class derived from CXTPMenuBar

class CLockMenuBar: public CXTPMenuBar
{
public:
    CLockMenuBar();
    DECLARE_MESSAGE_MAP()
    DECLARE_XTP_COMMANDBAR(CLockMenuBar)
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
    afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
};

2)  GetCommandBars()->SetMenuBarClass (RUNTIME_CLASS(CLockMenuBar));
     GetCommandBars()->SetMenu( _T(strCaption), IDR_MAINFRAME);

3) Implement the class methods as defined above to process the events according to a flag which is set when toolbars need to be locked.

Larry

Back to Top
larryp View Drop Down
Groupie
Groupie


Joined: 15 January 2005
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote larryp Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2005 at 10:24pm
First, I would like to say that so far I am impressed with the CodeJock library.  Great job.

Is there an easy way to prevent the toolbar from moving?  My program performs recording of data and during recording I need to disable the moving of the menubar and all toolbars.

I saw a previous post where someone described how to create a class derived from CXTPToolBar and passed as the third parameter to Add.  This allows me to catch the mouse click events to prevent moving the toolbars, but what about the menubar?

Larry


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