minnirok
asked on
CTabCtrl + CListCtrl causing problems
Ok I have a dialog that has a CTabCtrl and 2 CListCtrls.
The tab and the 2 lists are sibling controls. I was stretching the tab control to be the whole area of the dialog, then I was moving the two lists on top of the tab control to give the appearance that it was contained inside of it, something like this:
-----------------
|tab1 | tab 2 |
-------------------------- ---------- ---------- ---------- ------
| |
| -------------------------- ---------- ---------- -------- |
| | list 1 | |
| -------------------------- ---------- ---------- -------- |
| |
| -------------------------- ---------- ---------- -------- |
| | list 2 | |
| -------------------------- ---------- ---------- -------- |
-------------------------- ---------- ---------- ---------- ------
but now my lsits controls have some repainting issues. If I give one of the lists focus, open another window so it covers the list control, then switch focus back to my list, it fails to repaint that area where the overlap was. Is there anyway around this? I didnt want to make the 2 lists children of the tab because then it's another layer I have to get through to access the lists from other parts of my application.
Thanks
The tab and the 2 lists are sibling controls. I was stretching the tab control to be the whole area of the dialog, then I was moving the two lists on top of the tab control to give the appearance that it was contained inside of it, something like this:
-----------------
|tab1 | tab 2 |
--------------------------
| |
| --------------------------
| | list 1 | |
| --------------------------
| |
| --------------------------
| | list 2 | |
| --------------------------
--------------------------
but now my lsits controls have some repainting issues. If I give one of the lists focus, open another window so it covers the list control, then switch focus back to my list, it fails to repaint that area where the overlap was. Is there anyway around this? I didnt want to make the 2 lists children of the tab because then it's another layer I have to get through to access the lists from other parts of my application.
Thanks
Try to override WM_ERASEBKGND for both tab pages and redraw all background except area of listboxes. This will make tho holes in the tab control, possibly solving repainting problems.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ahhhh jeez unbelievable. I'll give it a try when I get back to the office on monday. It would be wonderful if that's all that's needed to fix it!
Thanks
Thanks
< it's another layer I have to get through to access the lists from other parts of my application.>
pView->m_lstCtrl1.XYZ();
instead of
m_lstCtrl1.XYZ();
For me that isn't a great deal more work.
pView->m_lstCtrl1.XYZ();
instead of
m_lstCtrl1.XYZ();
For me that isn't a great deal more work.
minnirok
Its not similar question? : https://www.experts-exchange.com/questions/21827049/repaint-clistctrl.html
Have you tried suggestions given on that ? also like issue RedrawWindow() instead of issuing an Invalidate in the OnPaint.
myCListCtrl.RedrawWindow(N ULL,NULL,R DW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
-MAHESH
Its not similar question? : https://www.experts-exchange.com/questions/21827049/repaint-clistctrl.html
Have you tried suggestions given on that ? also like issue RedrawWindow() instead of issuing an Invalidate in the OnPaint.
myCListCtrl.RedrawWindow(N
-MAHESH
Also if you have code like
((CMainFrame*)AfxGetMainWn d())->m_ls tCtrl1->XY Z();
then you can patch it up easily by creating the list controls in the OnCreate of the view then setting the value in the main frame to point to the list control in the view
pseudo code
CMyView::OnCreate(...)
{
CView::OnCreate(...)
create list control
then
((CMainFrame*)AfxGetMainWn d())->m_ls tCtrl1 = m_lstCtrl1;
}
((CMainFrame*)AfxGetMainWn
then you can patch it up easily by creating the list controls in the OnCreate of the view then setting the value in the main frame to point to the list control in the view
pseudo code
CMyView::OnCreate(...)
{
CView::OnCreate(...)
create list control
then
((CMainFrame*)AfxGetMainWn
}
Thanks for the points and the grade. Sometimes the simplest answer is the best.
-- Dan
-- Dan
I think it is now clearer for me as to what you meant with your app.
Do you know about property sheets and pages ? (That is a dialog with tabs on it - even simpler than coding it yourself)
Do you know about property sheets and pages ? (That is a dialog with tabs on it - even simpler than coding it yourself)