hiding ListViews

Thanks to everyone's comments on prior Win32 questions as I go from an embedded world to Win32. Different animal, but not that terribly hard. Just a lot of experimentation. But actually not too bad.

My latest question is that I have a main window with tabs (windows) at the top. In one tab (Overview), I have some text and 2 ListViews (tables of data). Got them populated with Items and SubItems.

So my main window has a handle and my ListViews have handles. And, the ListViews are not really part of the main window, but are displayed in the main window. When, I go to a different tab and want to erase the ListViews, do I have to delete all the rows and basically rebuild the ListViews each time I come back to the Overview tab? I can erase the main window, but that only erases the text associated with the main window. The ListView handles are global, but I'm not sure that matters. I was hoping to build up the tables and be able to display and hide them depending on which tab the user was on. And, not have to run the 'Create_Tables' function each time the users selects the OverView tab. But, maybe that's how you have to do it.

Best approach? Thanks.
Hi dodge55

First you need to have the windowhandels from the tabpages, to get them you need to use
TCM_GETCURSEL and TCM_GETITEMW

1
2
3
4
5
6
7
8
9
10
11
CASE WM_NOTIFY;
some more filtering with NMHDR;
and use TCITEMW structure;

                  CASE TCN_SELCHANGE;
                     ' // Show the selected page
                           ShowWindow hTabPage_selected, SW_SHOW;

                  CASE TCN_SELCHANGING;
                     ' // Hide the current page
                          ShowWindow hTabPage_current, SW_HIDE;

Now you dont have to earse or repaint anyting

I can't remember it well, but what i type here is correct.
Last edited on
A simple ShowWindow command hides and shows the windows. Should have figured that out.
Last edited on
yes, and an entirely hidden window 'scratch pad' can do wonders as something you never show the user. Some of the widgets are really nice just as data structures.
Topic archived. No new replies allowed.