|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Cristian
|
Sep 3, 2002 - 9:28 AM
|
How to disable the CloseBox in the CExtControlBar?
|
|
Jos Smit
|
Jan 16, 2008 - 8:26 AM
|
It’s working now. Thanks.
|
|
Technical Support
|
Jan 15, 2008 - 10:18 AM
|
We mean that CExtControlBar::g_nMsgCreateTabbedBar messages should be handled in the main frame window (CMainFrame ): LRESULT CMainFrame::OnMsgCreateTabbedBar( WPARAM wParam, LPARAM lParam )
{
lParam;
CExtDynTabControlBar ** ppBar = (CExtDynTabControlBar **)wParam;
(*ppBar) = new C_YOUR_DynTabControlBar;
return 0L;
} But you handled it inside your control bar class, which is incorrect.
|
|
Jos Smit
|
Jan 15, 2008 - 6:51 AM
|
I have this code:
// first the message handling BEGIN_MESSAGE_MAP(COurControlBar, CExtControlBar) ON_REGISTERED_MESSAGE(CExtControlBar::g_nMsgCreateTabbedBar, OnMsgCreateTabbedBar)//** this message never occurs END_MESSAGE_MAP()
LRESULT COurControlBar::OnMsgCreateTabbedBar(WPARAM wParam, LPARAM lParam) { CExtDynTabControlBar ** ppTabbedBar = (CExtDynTabControlBar **)wParam; ASSERT( ppTabbedBar != NULL ); (*ppTabbedBar) = new COurDynTabControlBar();
return 0; }
But a breakpoint in OnMsgCreateTabbedBar() is never hit. Then I tried this:
BOOL COurControlBar::PreTranslateMessage(MSG* pMsg) { UINT nMsgCreateTabbedBar= CExtControlBar::g_nMsgCreateTabbedBar; if (pMsg->message == CExtControlBar::g_nMsgCreateTabbedBar)//** this message never occurs { CExtDynTabControlBar ** ppTabbedBar = (CExtDynTabControlBar **)pMsg->wParam; ASSERT( ppTabbedBar != NULL ); (*ppTabbedBar) = new COurDynTabControlBar();
return TRUE; }
return CExtControlBar::PreTranslateMessage(pMsg); }
But that didn’t help either. I will try to strip my project so you can compile it. Then I’ll send it to you.
Thanks. You guys have been really helpful before. If I could rate your support I would give it a 10 (on a scale of 1 to 10).
|
|
Technical Support
|
Jan 11, 2008 - 11:39 AM
|
49901 is a valid value for the CExtControlBar::g_nMsgCreateTabbedBar variable.
A tabbed container for control bars is an instance of CExtDynTabControlBar . The latter is derived from CExtControlBar . So you can override CExtDynTabControlBar and remove the Close button in this method. When this custom class is ready, you can use it in Prof-UIS by handling the CExtControlBar::g_nMsgCreateTabbedBar registered windows message in your main frame window: class C_YOUR_DynTabControlBar : public CExtDynTabControlBar
{
. . .
};
ON_REGISTERED_MESSAGE( CExtControlBar::g_nMsgCreateTabbedBar, OnMsgCreateTabbedBar )
LRESULT CMainFrame::OnMsgCreateTabbedBar( WPARAM wParam, LPARAM lParam )
{
lParam;
CExtDynTabControlBar ** ppBar = (CExtDynTabControlBar **)wParam;
(*ppBar) = new C_YOUR_DynTabControlBar;
return 0L;
} If you still have problems, you can send us your project so we can help you find out what’s wrong.
|
|
Jos Smit
|
Jan 9, 2008 - 8:34 AM
|
I read the article "How to remove the close button ("X") from the control bar?" which tells how to disable the X for docked control bars. In order to make that work I must intercept the message CExtControlBar::g_nMsgCreateTabbedBar in my CExtControlBar-derived class. I tried doing that with the source code provided, but that didn’t work. Then I tried overriding PreTranslateMessage() but that didn’t work either.
I am wondering, is the variable CExtControlBar::g_nMsgCreateTabbedBar right initialized, in my case it has the value 49901 (0x0000c2ed). If so, why doesn’t this message occur. Or am I doing (or leaving) something else to prevent this message from occurring.
Jos Smit
|
|
Sergiy Lavrynenko
|
Sep 3, 2002 - 11:12 AM
|
Dear Cristian,
The non-client area buttons on the caption of the resizable control bar were conceived to be either visible or invisible. They can not be disabled.
You can use your own class derived from CExtControlBar. You should override the OnNcAreaButtonsReinitialize() method and put some initialization for non-client area buttons you need there. To remove all buttons from the caption, use an empty body in the function like in the code below:
void CMyResizableControlBar::OnNcAreaButtonsReinitialize() { }
To implement the "Expand/Contract" button only, use the following snippet:
void CMyResizableControlBar::OnNcAreaButtonsReinitialize() { INT nCountOfNcButtons = NcButtons_GetCount(); if( nCountOfNcButtons > 0 ) return; NcButtons_Add( new CExtBarNcAreaButtonExpand(this) ); }
You may also fake the disabled "X" button by implementing your own class, which should be derived from CExtBarNcAreaButton. You may use the CExtBarNcAreaButtonClose class code as a sample. In the OnNcAreaDraw() method, "X" must be always painted disabled. And implement the empty OnNcAreaClicked() method.
|
|
Cristian
|
Sep 4, 2002 - 3:48 AM
|
|
|