 |
|
 |
CTabbedMDIChildWnd::RepositionWindows()
{
...
p->MoveWindow(r,true); // JAS: Change to "true" to force a repaint.
}
I changed the "false" to "true" to force a repaint.
Otherwise, the first time I visited a tab they would appear blank for a while.
Also, if you use "_tcsdup" instead of _strdup in the two CTabItem constructors, then this builds correctly under Unicode builds.
|
|
|
|
 |
|
 |
Thanks for your comments John. You are right on both issues.
I merged your changes and submitted the updated zip files to Code Project for them to publish.
|
|
|
|
 |
|
 |
Hi all,
I have a problem when I use this code. Please help me to solve it.
In child frame I create two views and some control bars, these control bars are docked. Now I call some function to dock control bars to other side of child frame. The control bars are docked but views are not redrew.
How can I redraw the views when I change the control bar's position.
Thanks and best regard.
|
|
|
|
 |
|
 |
Van,
If your only problem is redrawing, you can call the Invalidate() method of the views in the code that docks the control bars.
Or maybe your problem is that the views are not repositioning correctly?
Cheers
eperales
|
|
|
|
 |
|
 |
the problem that occurs in my application is that the tab control that contail two views don't change automatically its client size. What function should I call to notify the tab control to update its position, update the view that it contains.
|
|
|
|
 |
|
 |
Did you tried RecalcLayout? It is part of CFrameWnd. I'm a little busy right now, but I'll test the case this weekend.
Hope this helps!
eperales
|
|
|
|
 |
|
 |
I have tried to add mouse double click events for those tabbed view,
but it never works.
Dennis hudr
|
|
|
|
 |
|
 |
Hi Dennis,
I added double click support in the demo to the class CTabbedFrameView as follows:
BEGIN_MESSAGE_MAP(CTabbedFrameView, CView)
...
ON_WM_LBUTTONDBLCLK()
...
END_MESSAGE_MAP()
and
void CTabbedFrameView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
AfxMessageBox(_T("Double Click!"));
CView::OnLButtonDblClk(nFlags, point);
}
also modifying the .h of course. It works like a charm... maybe I didnt understood your question
eperales
|
|
|
|
 |
|
 |
thanks. I made a mistake that i forgot to add ON_WM_LBUTTONBLCLK().
In your demo src file, i can't add this event callback by using class wizard. it's easy to make mistake to manually add this.
|
|
|
|
 |
|
 |
CTabbedMDIChildWnd::CTabItem::CTabItem(LPCTSTR szTabName, CRuntimeClass* prcView)
{
mask=TCIF_TEXT;
pszText=_strdup(szTabName); << pszText does not be freed
m_prcView=prcView;
}
So, I add some code at
CTabbedMDIChildWnd::~CTabbedMDIChildWnd()
{
std::vector<CTabItem>::const_iterator it = m_vectorTabItems.begin();
for(; it != m_vectorTabItems.end(); it ++ ) {
const CTabItem & item = *it;
free( item.pszText );
}
}
J.H.Park [IMC.co.kr]
|
|
|
|
 |
|
 |
sakeani,
You are right, there is a memory leak! what is really missing is the following destructor :
CTabbedMDIChildWnd::CTabItem::~CTabItem()
{
delete pszText;
}
I have asked the editors to update the article with this fix.
Adiós!
eperales
|
|
|
|
 |
|
 |
I’d tried it already.
But it call 'Copy operator of CTabbedMDIChildWnd::CTabItem'
A class, who has string pointer, can not be copied.
It results in freeing string twice.
|
|
|
|
 |
|
 |
CTabbedMDIChildWnd::CTabItem::CTabItem(const CTabItem& ti)
: TCITEM(ti)
{
pszText=_strdup(ti.pszText);
m_prcView=ti.m_prcView;
}
eperales
|
|
|
|
 |
|
 |
strdup uses malloc, so should be free()'d, not delete'd
|
|
|
|
 |
|
|
 |
|
 |
Always interrested in this kind of stuff
Check the following links, there is similar project that could please you also :
The father of all :
http://www.codeguru.com/Cpp/W-D/doc_view/tabs/article.php/c3347/
Zoran's version :
http://www.codeguru.com/Cpp/W-D/doc_view/tabs/article.php/c3357/
Zoran's masterpiece :
http://www.codeproject.com/dialog/visualfx.asp
Another one :
http://www.codeguru.com/Cpp/W-D/doc_view/tabs/article.php/c3247/
Kochise
In Code we trust !
|
|
|
|
 |
|
 |
Seems that your Google skills are better than mine!
I checked VisualFX, but it just seemed overkill for my small application.
So, for people looking for the minimalist version, here is it!
eperales
|
|
|
|
 |
|
 |
Just knowing CodeProject and CodeGuru almost by heart
Kochise
In Code we trust !
|
|
|
|
 |
|
 |
I’d tried it already.
But it call 'Copy operator of CTabbedMDIChildWnd::CTabItem'
A class, who has string pointer, can not be copied.
It results in freeing string twice.
J.H.Park [IMC.co.kr]
|
|
|
|
 |