ListView disappearing on resize!?

This is a discussion on ListView disappearing on resize!? within the Windows Programming forums, part of the Platform Specific Boards category; SetWindowPos and MoveWindow make it disappear. What do I have to do to make it redraw/paint/whatever? Code: //WM_SIZE in a ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    161

    ListView disappearing on resize!?

    SetWindowPos and MoveWindow make it disappear. What do I have to do to make it redraw/paint/whatever?

    Code:
    //WM_SIZE in a dialog's procedure
    case WM_SIZE:
    SetWindowPos(hListData, NULL, 0, 0, MainRect.right, MainRect.bottom, SWP_NOZORDER|SWP_SHOWWINDOW);
    //or
    MoveWindow(hListData, 0, 0, MainRect.right, MainRect.bottom, TRUE);

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Well, in the MoveWindow, you have the parameters mixed up. As it is, you're resizing the window to 0, 0.

    should be Handle, posx, posy, sizex, sizey, true); Or something to that effect -

    *Edit: actually, I think you're not moving the window and I haven't a clue as to what the size of the window is. Now I'm confused! In any event, I'm almost positive the parameters I mentioned as correctly sequenced -
    Last edited by Oldman47; 06-09-2008 at 05:51 PM.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    Doh. I should've tried with actual values. My calculations are off somehow. It works if I substitute other values for the 2 vars in the MoveWindow. Now I gotta figure out where I'm screwing up the values.

    Code:
            case WM_SIZE:
            {
                SendMessage(hStatus, WM_SIZE, 0, 0);
                RECT MainRect; memset(&MainRect,0,sizeof(MainRect));
                GetClientRect(hwnd,&MainRect);
                RECT StatusRect; memset(&StatusRect,0,sizeof(StatusRect));
                GetWindowRect(hStatus,&StatusRect);
                MainRect.right -= StatusRect.right - StatusRect.left;
                MainRect.bottom -= StatusRect.bottom - StatusRect.top;
                MoveWindow(hListData, 0, 0, MainRect.right, MainRect.bottom, TRUE);
    Edit: I got it now.

    Code:
            case WM_SIZE:
            {
                SendMessage(hStatus, WM_SIZE, 0, 0);
                RECT StatusRect; memset(&StatusRect,0,sizeof(StatusRect));
                GetWindowRect(hStatus,&StatusRect);
                MoveWindow(hListData, 0, 0, LOWORD(lParam), HIWORD(lParam) - (StatusRect.bottom - StatusRect.top), TRUE);
    Last edited by Viper187; 06-09-2008 at 06:03 PM.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    I'm certain you'll figure it out (or someone else will help you). I always disable resizing due to my windows being skinned, so it's been a while since I messed with what you're doing.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Resize Listview
    By mikeman118 in forum Windows Programming
    Replies: 4
    Last Post: 06-12-2008, 08:23 PM
  2. png Image Resize
    By bhupesh.kec in forum C Programming
    Replies: 3
    Last Post: 12-06-2007, 07:52 AM
  3. Prevent listview column resize
    By Stabbsy in forum Windows Programming
    Replies: 2
    Last Post: 05-31-2007, 12:03 AM
  4. Troubles with ListView and Toolbar
    By cornholio in forum Windows Programming
    Replies: 8
    Last Post: 11-14-2005, 01:26 AM
  5. Listview??
    By SuperNewbie in forum C# Programming
    Replies: 4
    Last Post: 02-13-2003, 03:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21