CTabView problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 22

Thread: CTabView problem

  1. #1
    Join Date
    Jan 2009
    Posts
    185

    CTabView problem

    For days I am struggling to solve a drawing issue on CTabView derived. Might be simple to solve this, but I didn't make it yet, and I decided to put this here, hoping to get some help.

    I even reproduce this into a test application in order to have clear image about this. (I attach test project below).

    I have an MDI app, and in CChildFrame I have splitter just like this:

    | | listview
    | tree |
    | |
    | |
    | |

    In tree-view, regarding where is selected, I dynamically show another CTabView, and this CTabView has several CListViews, just like this:

    | | listview
    | tree |--------------------
    | |
    | | tabview
    | |


    When I change an specific item into tree-view, the tabbed view is showing up, and the first tab (which contain an CListView) is activated. The problem is that this CListView, is not drawing well (for isntance, it hasn't horizontal scrollbar) !!!

    If I change manually some listview from CTabView, they are drawn well, even if I select back the first tabview.

    Scenario:

    I change an item in tree. CTabView is switching as visible, and the first tab is activated. This tab, having a CListView inside has NOT drawn well (no horizontal scrollbar).

    I manually change another tab in tabview, the listview inside are drawn well.
    I manually change the first tab, with listview inside. This time, the listview inside of had drawn well.

    Could you cut a little time from yours and give a little help ? It would means a lot for me.

    I come back immediately with what I have tried already.
    Attached Files Attached Files
    Last edited by mesajflaviu; April 7th, 2017 at 08:46 AM.

  2. #2
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    What I have tried: everytime when the treeview item has changed, I call in CExploreTabbedView:
    Code:
    OnActivateView(GetActiveView());
    or
    Code:
    GetActiveView()->Invalidate();
    Code:
    LRESULT CExploreTabbedView::OnPostInit(WPARAM wParam, LPARAM lParam)
    {
    	CMFCTabCtrl& MFCTabCtrl = GetTabControl();
    	for(int i = 0;i < MFCTabCtrl.GetTabsNum();++i)
    	{
    		CView* pView = (CView*)MFCTabCtrl.GetTabWnd(i);
    		pView->OnInitialUpdate();
    		pView->Invalidate();
    	}
    
    	return 1;
    }
    Code:
    	CMFCTabCtrl& MFCTabCtrl = GetTabControl();
    	for(int i = 0;i < MFCTabCtrl.GetTabsNum();++i)
    	{
    		SendMessage(AFX_WM_CHANGING_ACTIVE_TAB, i, 0);
    	}
    these calls I fired them right after tree item change selection, or through post messages, after tree item change selection. None of above trials had worked.
    Last edited by mesajflaviu; April 7th, 2017 at 04:12 AM.

  3. #3
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    Just on activation:
    https://s13.postimg.org/5p3k4r92f/Untitled2.png
    I manually change tabview, on tab 2:
    https://s13.postimg.org/vmkcd2unr/Untitled3.png

    I comeback on first view from tabview:
    https://s14.postimg.org/xzkttucmp/Untitled3.png
    Last edited by mesajflaviu; April 7th, 2017 at 04:14 AM.

  4. #4
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    I even handle WM_ERASEBKGND on CTabView derived, or CListView's inside of CTabView ... without success.

  5. #5
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    I noticed something: during childframe resizing, the hidden horizontal scrollbar of listview are flickering, but when I stopped resizing, the horizontal scrollbar remain hidden ... very strange ....

    The same came when I resize the listview headers, of ANY CTabView tab with CListView inside .... now become more strange !
    Last edited by mesajflaviu; April 7th, 2017 at 10:47 AM.

  6. #6
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    I have discovered something interesting: the horizontal scrollbar of CListView are interfered with tabview scrollbar, see image below:
    https://s14.postimg.org/x1vdq8att/Untitled4.png

    When I resize listview header, the horizontal scrollbar of listview AND the horizontal scrollbar of tabview are resizing the same ! It is normal ?

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,543

    Re: CTabView problem

    I would change the app to use a pseudo tab view. What I mean here is to use a tab control but don't add list control to each tab. Instead, size the tab control so that only the tabs appear and use a single list control. When the user changes tabs, just repopulate the same list control (and change the columns and rows as appropriate per each selected tab).

  8. #8
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    I reduced the issue at simple one: the scrollbar of the tabview are interfered with listview scrollbar.

    On the open, I have listview scrollbar:
    https://s9.postimg.org/plazdii0f/Untitled5.png
    After I resize a listview column, the listview scroolbar has disappeared:
    https://s7.postimg.org/48nuybe4r/Untitled6.png

    And while I resize the listview scrollbar, the tabview scrollbar is resizing as well ... strange ...

    Why is happen this ?
    Last edited by mesajflaviu; April 9th, 2017 at 02:03 AM.

  9. #9
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    Quote Originally Posted by Arjay View Post
    I would change the app to use a pseudo tab view. What I mean here is to use a tab control but don't add list control to each tab. Instead, size the tab control so that only the tabs appear and use a single list control. When the user changes tabs, just repopulate the same list control (and change the columns and rows as appropriate per each selected tab).
    Being this problem (see the post above), I don't think that this is solve the problem, and it would complicate the code ... I guess ...
    Last edited by mesajflaviu; April 9th, 2017 at 02:12 AM.

  10. #10
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    Here is the code that configure the tabview:
    Code:
    	CMFCTabCtrl& MFCTabCtrl = GetTabControl();
    	MFCTabCtrl.SetLocation(CMFCBaseTabCtrl::LOCATION_BOTTOM);
    	MFCTabCtrl.SetActiveTabBoldFont(TRUE);
    	MFCTabCtrl.ModifyTabStyle(CMFCTabCtrl::STYLE_3D);
    	MFCTabCtrl.EnableTabSwap(TRUE);
    	MFCTabCtrl.EnableTabDocumentsMenu();
    	MFCTabCtrl.HideActiveWindowHorzScrollBar();

  11. #11
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    I have made a simple test project that demonstrate the issue.
    Attached Files Attached Files

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,543

    Re: CTabView problem

    Quote Originally Posted by mesajflaviu View Post
    Being this problem (see the post above), I don't think that this is solve the problem, and it would complicate the code ... I guess ...
    With the tab view you have a hiearchy of the tab window, tab pages and multiple list controls (and the scrollbars of one level interfering with each other). My suggestion flattens the hierarchy so the tab control is no longer the parent of the tab page and list control.

  13. #13
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    Ok, I will try what you have said ... I thought that this architecture is not so bad to use it ... but I will try your idea ...

  14. #14
    Join Date
    Jan 2009
    Posts
    185

    Re: CTabView problem

    Is there a reason that a CListView should not be able to redrawn ? After I add new view in tabview at runtime, all CListView are not drawn properly (I can see scrollbars only if I move the mouse over scrollbar area).

  15. #15
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,928

    Re: CTabView problem

    Hi, I guess it could be an old bug of List Control itself (there was a a non-fixed bug since at least two decades). See the https://connect.microsoft.com/Visual...mmon-control-6
    and some similar discussions:
    http://forums.codeguru.com/showthrea...ars&highlight=
    http://forums.codeguru.com/showthrea...k-on-scrollbar

    https://www.google.de/webhp?sourceid...ollbar+connect
    Victor Nijegorodov

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)