 |
|
 |
When switching between maximized MDI windows there exists a flicker.
FIX:
BEGIN_MESSAGE_MAP(CMDIClient, CWnd)
.......
.......
ON_WM_MDIACTIVATE()
.......
.......
END_MESSAGE_MAP()
void CMDIClient::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
SendMessage(WM_SETREDRAW,FALSE,NULL);
CWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
SendMessage(WM_SETREDRAW,TRUE,NULL);
InvalidateRect(NULL,TRUE);
SetWindowPos(NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME);
}
|
|
|
|
 |
|
 |
If you want to dock this right of another toolbar, you can make this little change.
CSize CViewManager::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
{
ASSERT_VALID(this);
ASSERT(::IsWindow(m_hWnd));
if (bStretch) // the bar is stretched (is not the child of a dockbar)
return CSize(bHorz ? 32767 : m_sizeDefault.cx, bHorz ? m_sizeDefault.cy : 32767);
CClientDC dc(NULL);
HFONT hFont = reinterpret_cast(SendMessage(WM_GETFONT));
HFONT hOldFont = NULL;
if (hFont != NULL)
hOldFont = reinterpret_cast(dc.SelectObject(hFont));
TEXTMETRIC tm;
VERIFY(dc.GetTextMetrics(&tm));
if (hOldFont != NULL)
dc.SelectObject(hOldFont);
// get border information
CRect viewrect,parentrect; // new
GetWindowRect(viewrect); // new
GetParent()->GetWindowRect(parentrect); // new
int diff = viewrect.left - parentrect.left; // new
CSize size;
CRect rcInside, rcWnd;
rcInside.SetRectEmpty();
CalcInsideRect(rcInside, bHorz);
GetParentFrame()->GetWindowRect(&rcWnd);
size.cx = rcWnd.Width() - diff; // changed
size.cy = tm.tmHeight + tm.tmInternalLeading // - 1
+ ::GetSystemMetrics(SM_CYBORDER) * 5 - rcInside.Height();
return size;
}
|
|
|
|
 |
|
 |
Hi
Fine work but there is a little problem of memory leak.
In the CMDIClient constructor, you should not get memory for the LOGFONT. Because the function GetProfileBinary that you call is also doing it and so the memory you got before is lost.
If you look inside GetProfileBinary, you can see
BOOL CWinApp::GetProfileBinary(LPCTSTR lpszSection, LPCTSTR lpszEntry,
BYTE** ppData, UINT* pBytes)
{
.../...
*ppData = NULL; <-- Your memory for LOGFONT is lost here
.../...
*ppData = new BYTE[*pBytes];
.../...
The corrected code is :
CMDIClient::CMDIClient()
.../...
LOGFONT* plf = NULL; //DO NOT DO THIS -> = new LOGFONT;
UINT dwSize = sizeof(LOGFONT);
bSuccess = pApp->GetProfileBinary(szSection, szLogoFont, (BYTE**)&plf, &dwSize);
.../...
if (plf)
delete plf;
.../...
|
|
|
|
 |
|
 |
Hi,
How can I use the flat buttons style, and overwrite the drawing of the tab so that the selected tab will not be sunken (I just want to fill the selected rect with white background).
How can I do it?
I'll also appriciate sample code if its not to hard.
Thanks
|
|
|
|
 |
|
 |
Hi
I want the control bar to be loaded at the bottom of the window by default,every time when i starts the application.
I tried it with CBRS_BOTTOM,but it is not working...
Can anybody help me...
Thanks
|
|
|
|
 |
|
 |
hello,
DockControlBar(&m_wndToolBar, AFX_IDW_DOCKBAR_BOTTOM);
----This will help you to position your Control bar at the bottom
CPoint m_pointPosToolBar = CPoint(100,100);
FloatControlBar(&m_wndToolBar,m_pointPosToolBar);
---This will help you to position your Control at desired CPoint coordinate
|
|
|
|
 |
|
 |
hi dear.
I am trying to create an application-MDI container-and I want to have a fullscreen mode when the user insert an object in a view. you know I use stingray but it doesn't allow it so i changed the code. but when it goes to fullscreen and i try to switch betweeb views it's crash or the menu makes disable.
please help me if you know anything.
thanks.
Saeed Shahbazi.
|
|
|
|
 |
|
 |
It is difficult to see where the problem is. Can you create a simple demo and send it to me?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |
|
 |
the pch file is missing. please fix !
thanks,
Shubha Ramani
shubha ramani
shubharamani@yahoo.com
|
|
|
|
 |
|
 |
Turn off use of precompiled headers.
|
|
|
|
 |
|
 |
It's Very good Code,I using These Code in my new project,I showed derivation of these code in my project.Thanks you!
I'm Chinese Programmer.My name is Jianyong.
|
|
|
|
 |
|
 |
This code was also usefull to me,
but if u know how to use the CScrollView
in MDI with base class as CView.
I basically want to display some data
to the user with scrolling capability
but there is and error as the new view
i have crated is a Child to the main
window , an assertion is displayed.
Thanking you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
 |
|
 |
Whit this new update the buttons on the controlbar look like a ordinary tab control. In the previous version it looked like plain buttons on a controlbar.
I want the old looking. How do i do that?
|
|
|
|
 |
|
 |
Hello,
Nothing changed. From the Demo menu select "Demo" to display a dialog box. Play with the "View tab button style" you will see how to set all the styles.
The previews version has the "Buttons" and "Flat Buttons" as the default style. The current version has "Normal" as the default style.
If you still have problem, let me know.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |
|
 |
Hi:
I find a bug in the CTabCtrl.When you press "Ctrl+N" to create many views,then close one by one from the end, you will see the drawing of the ctabctrl is not correct.Maybe this is a bug of CTabCtrl, and do you have any idea ?
thanks
benben
|
|
|
|
 |
|
 |
Please can you send me a screenshot of the wrong tab drawing. I am trying to reproduce the bug but still could not get it.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |
|
 |
Open up as many windows that you get the scroll button, which is really a msctls_updown32 control. Resize your window so you get your last view under msctls_updown32 button and also maximaze the tab window by double clicking on title bar. Now start hitting the "x" to close tab from the last, you will see the problem with CTabCtrl that it does not update all the tabs rather the control bar is appeared empty but if you click on comtrol bar area then it updates that tab only. Its a bug in CTabCtrl Microsoft needs to be informed. If some one knows the solution please drop me email. Thanks
|
|
|
|
 |
|
 |
I reproduced the bug, I think you can scroll the tab when it's invisible.
Take the code for scrolling the tab control.
// Get the up-down (spin) control that is associated with the tab control
// and which contains scroll position information.
if( !m_pSpinCtrl )
{
CWnd * pWnd = FindWindowEx( GetSafeHwnd(), 0, _T("msctls_updown32"), 0 );
if( pWnd )
{
// DevNote: It may be somewhat of an overkill to use the MFC version
// of the CSpinButtonCtrl since were actually only using it
// for retrieving the current scroll position (GetPos). A simple
// HWND could have been enough.
m_pSpinCtrl = new CSpinButtonCtrl;
m_pSpinCtrl->Attach(pWnd->GetSafeHwnd());
}
}
CRect rect;
GetClientRect(&rect);
// Examine whether we should scroll left...
if( point.x < rect.left && m_pSpinCtrl )
{
int nPos = LOWORD(m_pSpinCtrl->GetPos());
if( nPos > 0 )
{
InvalidateRect(&m_InsertPosRect,false);
ZeroMemory(&m_InsertPosRect,sizeof(m_InsertPosRect));
SendMessage(WM_HSCROLL,MAKEWPARAM(SB_THUMBPOSITION,nPos-1),0);
}
}
// Examine whether we should scroll right...
if( point.x > rect.right && m_pSpinCtrl && m_pSpinCtrl->IsWindowVisible())
{
InvalidateRect(&m_InsertPosRect,false);
ZeroMemory(&m_InsertPosRect,sizeof(m_InsertPosRect));
int nPos = LOWORD(m_pSpinCtrl->GetPos());
SendMessage(WM_HSCROLL,MAKEWPARAM(SB_THUMBPOSITION,nPos+1),0);
}
original code link is http://www.suodenjoki.dk/us/productions/articles/dragdroptab.htm#Scrolling[^]
|
|
|
|
 |
|
 |
[EDIT]
Oooops - Its not a bug in your source. It was a bug in mine. I recently upgraded my older version with parts of this new one. So if you do the same, this could apply to you.
[/EDIT]
In the file ViewManager.cpp, a message map entry is declared incorrectly. The line
ON_NOTIFY(TTN_NEEDTEXT, 0, OnViewManagerToolTip)
should be
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnViewManagerToolTip)
This cause the MDC OnCmdMsg() function to call OnViewManagerToolTip() with only 2 parameters and not 3 which you get for ON_NOTIFY_EX. This bug has sneaked in from an earlier version of this source which was correct.
To simulate it, run the code in debug mode and get a tooltip to appear. On my system I get an application error deep in MFC code. Not sure what bad things it would do in release mode.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
 |
|
 |
Well, this article needs an update and I will do all to update it this weekend - just busy porting a huge application to .NET now
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |
|
 |
I'm trying to have different views for my documents. But when i change view, and then use RemoveView or by calling DestroyWindow on the old view, i get a program crash on line 94 in ViewManager.cpp.
Anybode know what i can do to be able to change views and still use this MDI Tab Bar?
|
|
|
|
 |
|
 |
I had an updated version long ago, just feeling lazy. I could send you the codes if you wish.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |
|
 |
Not everyone has a Tool- and StatusBar in his MainFrame. In that case the code just crashes.
|
|
|
|
 |
|
 |
Hello,
Sorry, for not updating these codes. Now, please explain your problem a bit more - I do not clearly understand your statement.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
 |
|
 |
Your code seems to assume blindly that CMainFrame has CStatusBar and CToolbar members which doesn't have to be the case. I have created an application which doesn't have either of them, instead Tool- and Statusbar's are created inside the child frames. I also tried to remove them from your demo application, commented out the calls to their members functions and your demo also crashes when the main window is created.
|
|
|
|
 |