|
|
Comments and Discussions
|
|
 |

|
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; <-- :confused: Your memory for LOGFONT is lost here
.../...
*ppData = new BYTE[*pBytes];
.../...
The corrected code is :
CMDIClient::CMDIClient()
.../...
LOGFONT* plf = NULL; :-D //DO NOT DO THIS -> :mad: = 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.
|
|
|
|

|
I understand your problem. However, it is clearly stated above that those are required for the full screen support. These are simple set of classes you can modify for your application.
Anyway, I will try to update these codes by Monday - sorry for any inconvenience.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|

|
LOGFONT* plf = new LOGFONT;
UINT dwSize = sizeof(LOGFONT);
bSuccess = pApp->GetProfileBinary(szSection, szLogoFont, (BYTE**)&plf, &dwSize);
...
delete plf;
The new statement is false in this case because GetProfileBinary allocate its own memory and directs then the plf pointer to it. So the memory you allocated with "new" will never be destroyed.
Working code:
LOGFONT* plf = NULL;
UINT dwSize = 0;
...
|
|
|
|

|
Yes, save me some effort to find the leak.
Thanx.
Look into my eyes,
and you see yourself.
|
|
|
|

|
Hi all,
This is a great piece of code but falls over if you try and use it with a MDI app which has a spliiter view in the child window. I have tinkered with it *really* quickly and got it sort of working in that it will now display the child window but does not add it to the tab control
Basically just put in 2 lines of code as below so if the document can be evaluated then skip it rather than crash'n'burn
Line 103 in
void CWindowTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
CView* pView = reinterpret_cast(tci.lParam);
CDocument* pDoc = pView->GetDocument();
//insert this if statment
if (pDoc==NULL)
return;
I'm pretty sure it will be possible to get the splitter winodow in the tab also. If anyone figures it out please let me know.
-==Scott==-
|
|
|
|

|
I got it working by creating this function in my splitter class, then changing the 2 occurances of GetDocument() to FetchDoc() CDocument * CSpodSplitterWnd::FetchDoc() { TRACE("Retriving view...\n"); C3WaySplitterFrame * pFrameWnd = (C3WaySplitterFrame *) GetParentFrame(); return pFrameWnd->pDoc; } Whether it is doing something completly wrong or not, i don't know - i've only been playing with windows/mfc/c++ for a week now (i'm a hard core linux coder at heart, who has had to write a windows app!) -- It works for me (i think )!
Theo/Zozo
|
|
|
|

|
how to "Add the resource file tabview.rc to the project's *.rc2 file, "
|
|
|
|

|
Hi,
Open the tabview.rc with a TextEditor application (notepad.exe for example) and copy all its lines.
then... There is a file named MyApplication.rc2 in the "\res" directory or in your project's. Open it with a TextEditor also, there u'll find something like:
...
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
....
Just paste the lines here. Done!
Dirso.
|
|
|
|
|

|
Hello All,
There is a serious bug when the code is used in Splitter windows supporting views. I am currently addressing this. Sorry for any headache.
Best regards,
Paul.
|
|
|
|

|
Hello Paul,
Have you fixed this bug or looked into it further? I am pretty sure thats why I can't get this to work. When I run it in my project (which uses split windows) I get all kinds of assert failures and the program eventully has a fatal crash. Can you help me? Otherwise this is real nice and great work. Is'nt this a great addition to every project, eh?
Have a nice day,
Jef
|
|
|
|

|
Hello Jeff,
Thanks for your interest in this code. I have fixed this bug log ago. In actual fact, there is a rewrite of the management stuff, but will not affect any existing codes. The problem is I had some other feature request, which too sometime to implement and a user contributed some cool additions I need to merge. However, I could not manage the time yet to do this.
Another issue is the use of this codes in Stas BCG library. The library subclass the MDI client the MFC way, which means that on other codes using the MFC-style of subclassing will work. After a long consideration, I decided to rewrite the BCG code and submit it for contribution, since the MDI client is a limited resource!
Now, if you can provide the required testing for me, I could easily complete the updates to this code.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
A dockable bar containing a tabbed list of open windows
| Type | Article |
| Licence | Public Domain |
| First Posted | 31 Jan 2000 |
| Views | 194,456 |
| Bookmarked | 78 times |
|
|