Print Page | Close Window

Prevent menubar from moving.

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=1844
Printed Date: 08 July 2024 at 1:47am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Prevent menubar from moving.
Posted By: larryp
Subject: Prevent menubar from moving.
Date 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





Replies:
Posted By: larryp
Date 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



Posted By: Oleg
Date Posted: 01 March 2005 at 11:55pm

pMenBar->EnableDocking(xtpFlagStretched);

PToolBar1->EnableDocking(xtpFlagHideWrap);

...

 

seems it will be easy ;)



-------------
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