|
Hi,
if I resize the Control Bar the Text of the Tablabels didn't change. What must i do to get the same funtion like the Tabcontrol in Visual Studio.
The Labeltext should be to cut short with Text and Dots to the Label Dimensions (i.e. "Data..." for Text "Database")
Thanks for every solution or answer
|
|
|
|
|
Hello,
i have a problem with the CSizingControlBar classes. Here are the description of the problem:
After starting the application, the control bar is docked on the right side of the mainframe. Now i click into the treeview.
Then i do a double click on the control bar, to make the control bar floating.
After this, i close the control bar with the x button.
And now there is the following problem:
After closing the control bar, the mainframe don't receive any messages. This means, i cannot pull down a menu or close the application.
Do anyone have a solution for this problem. How can i make my mainframe working after closing the controlbar.
Can anybody help me.
Thanks
Holger
|
|
|
|
|
I had the same problem and haven't solve it yet. This happens because I (and you maybe) use the newer version of CSizingControlBar from Cristie. I only figured out that the main problem is in AddView function of CSizingTabCtrl. If you comment this function in CMainFrame:OnCreate() this wont happen with your bar so the obvious problem is there and I think we should look error there. If you find solution and if it's no trouble to you please notify me!
nenad
|
|
|
|
|
I have just found the problem in AddView function but...
I did this commented line code in CSizingTabCtrlBar::AddView :
...
int nViews = m_views.GetCount();
if (nViews!=1)
{
pWnd->EnableWindow(FALSE);
pWnd->ShowWindow(SW_HIDE);
}
else
{
// ((CFrameWnd *)GetParent())->SetActiveView((CView *)m_pActiveView);
}
...
putting active view: I haven't thought for now what will happen in the future if this must be set here. Maybe someone knows this?
|
|
|
|
|
in execute time,if i disable the default document , then here is no first empty EditView.
use belowe statment in app::InitInstance() to disable default document .
(
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);
)
until i resize the MainFrame , the classView and Tabctrl show. does there hay body know , how to fix it??start with
no default document .
beside this , the title-bar(Wnd) of CSizingTabCtrlBar, how can i deal it like "http://www.codeproject.com/docking/sizecbar.asp" Cristi Posea , it has two lines on top and one "X"??
|
|
|
|
|
when I created CSizingTabCtrlBar class from new version of CSizingControlBar and there is problem with handling X-button. First thing that pops up is ASSERT error in function
CSizingControlBar::OnSize(UINT nType, int cx, int cy)
When I comment this assert program works but... when I close dockbar I lose connection to main app and the only thing I can do is closing app. If I don't use function AddView in CMainFrame::OnCreate(),closing(showing/hiding) with that docbar works fine. So the problem is AddView function. I didn't discovered yet. Has anybody same problems as I do? Has anybody idea how to solve this problem?
|
|
|
|
|
Hi,
I was trying to create a dockable window using SizingTabCtrlBar with new base class by Cristi Posea. The problem is that when I want to "close"(hide) window code goes "somewhere" and I lose control of main app.Can someone help (any idea where do I lose window handle-that is obvious, but where to look)? I want to have a grip bar and close button (like VC++ ide) so I use new version of the same CSizingControlBar.
I also get ASSERT error in:
void CSizingControlBar::OnSize(UINT nType, int cx, int cy)
{
.. pWnd->MoveWindow(0, 0, cx, cy);
ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
..
}
Anyone knows how to cope with this error? Is this maybe the problem why x-button does things above?
|
|
|
|
|
How to design CSizableControlBar,CSizingTabCtrlBar classes?IF u know
please send code?
|
|
|
|
|
I have tried adding a listview to the Resizable TabControl, however nothing is shown, whereas all other views that I add are displayed. Anybody else had this problem?
Any solution?
|
|
|
|
|
Modify Sample Source
1. Create Windows Style
2. Invalidate ShowWindow
BOOL CSizingControlBar::Create(CWnd* pParentWnd, CSize sizeDefault, UINT nID, DWORD dwStyle)
{
// must have a parent
ASSERT_VALID(pParentWnd);
// cannot be both fixed and dynamic
// (CBRS_SIZE_DYNAMIC is used for resizng when floating)
ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));
m_dwStyle = dwStyle& CBRS_ALL; // save the control bar styles
// register and create the window - skip CControlBar::Create()
CString wndclass = ::AfxRegisterWndClass(CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW),
::GetSysColorBrush(COLOR_BTNFACE), 0);
dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS ; // prevents flashing
if (!CWnd::Create(wndclass, NULL, dwStyle, CRect(0, 0, 0, 0), pParentWnd, nID))
return FALSE;
return TRUE;
}
void CSizingTabCtrlBar::OnSize(UINT nType, int cx, int cy)
{
CSizingControlBar::OnSize(nType, cx, cy);
int bottom = (IsHorz() || IsFloating()) ? cy - 14 : cy - 18;
m_tabctrl.MoveWindow(7, 7, cx - 14, bottom);
CWnd *pWnd;
int nNewTab = 0;
for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos))
{
pWnd=m_views.GetAt(pos)->pWnd;
// pWnd->MoveWindow(9, 9, cx-19, bottom-26);
if (m_nActiveTab == nNewTab)
{
pWnd->SetWindowPos(NULL, 9, 9, cx-19, bottom-26, SWP_SHOWWINDOW);
pWnd->Invalidate(TRUE);
}
else
pWnd->SetWindowPos(NULL, 9, 9, cx-19, bottom-26, SWP_HIDEWINDOW|SWP_NOREDRAW|SWP_NOZORDER);
nNewTab++;
}
}
|
|
|
|
|
How to add this CSizingControlBar to SingleDocument? This code work only MultiDocument
|
|
|
|
|
I would like to know if any one else out there has had any problems runnin this code with VS 6 service pack 4. The problem is in:
CSizingControlBar::Create
it asserts when it gets all the way down to:
CControlBar::AssertValid()
at the statment
ASSERT((m_dwStyle & CBRS_ALL) == m_dwStyle);
If I ignore the assertions it works fine. Any ideas on how to fix this
|
|
|
|
|
Fix for VC++ 6.0
--------------------------------------------------------------------------------
In BOOL CSizingControlBar::Create(),
Modify
m_dwStyle = dwStyle;
to
m_dwStyle = dwStyle & CBRS_ALL;
This fixes the crash.
|
|
|
|
|
Thanks !! very good
|
|
|
|
|
Hi there!
Problem:
I put a TreeView into a dockin CtrlBar. I gave it the TVS_EDITLABELS style. But when editting a label u won't be able to use "Enter" to finish (u'll have to click somewhere with the mouse). [u can easily test this effect with the provided demo-project]
When I added a WM_KEYDOWN handler i didn't recieve messages for ENTER and ESCAPE as well ... although msgs on keys like 'a' can be recieved.
I tried several other Views in the DockingCtrlBar - always same effect.
Does anyone know, how to "enable" the ENTER and ESCAPE messages?????????????
Big thanks in advance!
Tommy [tombarthel@gmx.net
|
|
|
|
|
Add this code in ur view...
BOOL CResourceView::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN )
{
// When an item is being edited make sure the edit control
// receives certain important key strokes
if( m_pWaitingTreeCtrl->m_pTreeCtrl->GetEditControl()
&& (pMsg->wParam == VK_RETURN
|| pMsg->wParam == VK_DELETE
|| pMsg->wParam == VK_ESCAPE
|| GetKeyState( VK_CONTROL)
)
)
{
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
return TRUE; // DO NOT process further
}
}
return CTreeView::PreTranslateMessage(pMsg);
}
Suresh Balivada
|
|
|
|
|
if (pContext == NULL)
{
// if no context specified, generate one from the currently selected
// client if possible
CView* pOldView = NULL;
here we r setting pOldview = NULL explicitly. then
what is the use of next block of code.
if (pOldView != NULL && pOldView->IsKindOf(RUNTIME_CLASS(CView)))
{
}
Again I whenever I select Item from any tree , toolbars get disabled or assertion failure.
if anybody knows solution for this...then let me know.
Thanks
Sanj
|
|
|
|
|
When we click on item in tree, toolbar get disabled ie
views in the docking bar become active view making main view unactive. To make it active view we need to set it
by foolowing way.
POSITION POS = AfxGetApp ()->GetFirstDocTemplatePosition( );
ASSERT (POS);
CSingleDocTemplate* pDocTemp = (CSingleDocTemplate*)AfxGetApp ()->GetNextDocTemplate(POS );
ASSERT (pDocTemp);
POS = pDocTemp->GetFirstDocPosition( );
ASSERT (POS);
CNcxDoc *pDoc = (CNcxDoc *)pDocTemp->GetNextDoc(POS);
ASSERT (pDoc);
POSITION viewPos = pDoc->GetFirstViewPosition();
CNcxView *pView1 = (CNcxView *)pDoc->GetNextView(viewPos);
CMainFrame * pMainFrame =(CMainFrame *)AfxGetMainWnd();
pMainFrame->SetActiveView (pView1);
|
|
|
|
|
If I want to add edit box/button below tabs in docking window,after adding that can we switch between views ? can we do this.
If anyone have suggestions I would welcome hearing them.
Thanks
|
|
|
|
|
I quitted my job several weeks ago. So, currently I do not have Visual Studio to go on developing any further MFC classes nor in maintaining this class. Sorry!
I would be very lucky, if you all will go on to develop further this class.
Best regards,
Dirk
|
|
|
|
|
Here's one to watch out for ... if using CSizingTabCtrlBar with a CListView derived class.
When the controlbar is floating, the listview can periodically get into a confused state, where it captures all user input and will not release the focus until the window is re-docked to the mainframe (activation problem).
Got around this with a solution from Paul Di Lascia (MSJ, January 2000 (Q&A)). Apparently, CView::OnMouseActivate does a lot of ducking and diving to make sure the activation works correctly.
Add the following to your CListView derived class to avoid the issue. This may also be a problem with other CView derived classes.
int CMyListView::OnMouseActivate(...)
{
// bypass CView doc/frame stuff
return CWnd::OnMouseActivate(...);
}
void CMyListView::OnDestroy()
{
// bypass CView doc/frame stuff
CWnd::OnDestroy();
}
|
|
|
|
|
I had this happen in cformview also.....it is definitely a problem....but the fix works, thanx.
|
|
|
|
|
HI I am want to build an dialog app that has a 2 treectrl that I can hit tabs to active them like VC++
How can I do this....
Thanks
|
|
|
|
|
Redrawing problem cauzed by Z- order !
Solution :
BOOL CSizingTabCtrlBar::AddView(LPCTSTR lpszLabel, CRuntimeClass *pViewClass, CCreateContext *pContext)
{
#ifdef _DEBUG
ASSERT_VALID(this);
ASSERT(pViewClass != NULL);
ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
ASSERT(AfxIsValidAddress(pViewClass, sizeof(CRuntimeClass), FALSE));
#endif
CCreateContext context;
if (pContext == NULL)
{
// if no context specified, generate one from the currently selected
// client if possible
CView* pOldView = NULL;
if (pOldView != NULL && pOldView->IsKindOf(RUNTIME_CLASS(CView)))
{
// set info about last pane
ASSERT(context.m_pCurrentFrame == NULL);
context.m_pLastView = pOldView;
context.m_pCurrentDoc = pOldView->GetDocument();
if (context.m_pCurrentDoc != NULL)
context.m_pNewDocTemplate =
context.m_pCurrentDoc->GetDocTemplate();
}
pContext = &context;
}
CWnd* pWnd;
TRY
{
pWnd = (CWnd*)pViewClass->CreateObject();
if (pWnd == NULL)
AfxThrowMemoryException();
}
CATCH_ALL(e)
{
TRACE0("Out of memory creating a view.\n");
// Note: DELETE_EXCEPTION(e) not required
return FALSE;
}
END_CATCH_ALL
ASSERT_KINDOF(CWnd, pWnd);
ASSERT(pWnd->m_hWnd == NULL); // not yet created
DWORD dwStyle = AFX_WS_DEFAULT_VIEW;
CRect rect;
// Create with the right size and position
if (!pWnd->Create(NULL, NULL, dwStyle, rect, this, 0, pContext))
{
TRACE0("Warning: couldn't create client pane for view.\n");
// pWnd will be cleaned up by PostNcDestroy
return FALSE;
}
//**************************this is the solution***************************************
pWnd->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOREDRAW);
m_pActiveView = (CView*) pWnd;
TCB_ITEM *pMember=new TCB_ITEM;
pMember->pWnd=pWnd;
strcpy(pMember->szLabel, lpszLabel);
m_views.AddTail(pMember);
int nViews = m_views.GetCount();
if (nViews!=1)
{
pWnd->EnableWindow(FALSE);
pWnd->ShowWindow(SW_HIDE);
}
else
{
((CFrameWnd *)GetParent())->SetActiveView((CView *)m_pActiveView);
}
TC_ITEM tci;
tci.mask = TCIF_TEXT | TCIF_IMAGE;
tci.pszText = (LPTSTR)(LPCTSTR)lpszLabel;
tci.iImage = nViews-1;
m_tabctrl.InsertItem(nViews, &tci);
return TRUE;
}
|
|
|
|
|
Hi,
this was a solution.
I had a problem is I maximize the application the treeviews in the tabcontrolbar will not be redrawn.
if i use the code:
pWnd->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOREDRAW);
in the funcition addview everything works fine.
but why ?
what does the function setwindowPos an why the views now will be redrawn ?
|
|
|
|
|