Thread: Coordinate issues

  1. #1
    Registered User
    Join Date
    Jun 2008

    Coordinate issues

    Ok, I've done my own listview edit box for editing subitems and such before, but I can't get it positioned right this time around. Last time, all I did was use LVM_GETSUBITEMRECT and position the edit box accordingly. This time, however, the listview is inside a groupbox on a tab. LVM_GETSUBITEMRECT isn't getting me what I need anymore. The damn edit box appears way outside the listview and groupbox. This is confusing as hell.

    			    case LSV_CS_BEGINEDIT:
    			        if (lvExEditedItem.Status) { MessageBox(NULL,"Already editing. WTF? (LSV_BEGINEDIT)","Error",0); break; }
    			        if (HIWORD(lParam) <= 0) { break; }
    			        char txtInput[20];
    			        LV_ITEM lvItem; memset(&lvItem,0,sizeof(lvItem));
    			        lvItem.iItem = LOWORD(lParam);
    			        lvItem.iSubItem = HIWORD(lParam);
    			        lvExEditedItem.iItem = lvItem.iItem;
    			        lvExEditedItem.iSubItem = lvItem.iSubItem;
    			        RECT lvEditRect; memset(&lvEditRect,0,sizeof(lvEditRect));
    	 = lvItem.iSubItem;
    			        lvEditRect.left = LVIR_LABEL;
    			        SendMessage(hExSearchList, LVM_GETSUBITEMRECT, lvItem.iItem, (LPARAM)&lvEditRect);
    			        SendMessage(hExEdit, EM_SETLIMITTEXT, 8, 0);
    			        SendMessage(hExSearchList, LVM_GETITEMTEXT, lvItem.iItem, (LPARAM)&lvItem);
    			        SendMessage(hExEdit, EM_SETSEL, 0, -1);
    			        lvExEditedItem.Status = 1;
    			    } break;

    EDIT: I think I solved it.
    Last edited by Viper187; 09-21-2008 at 08:53 AM.

  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    You need to be careful with 'client' coords [relative to the top left corner of the window/control]

    as opposed to screen or window coords [relative to the top left of the screen].

    ScreenToClient() or ClientToScreen() will be of help here.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. liniting values of a custom coordinate
    By sh3rpa in forum C++ Programming
    Replies: 3
    Last Post: 11-11-2007, 05:22 PM
  2. hexdump issues
    By daluu in forum C Programming
    Replies: 2
    Last Post: 03-04-2003, 09:01 PM
  3. Coordinate Plane
    By Extol in forum C++ Programming
    Replies: 1
    Last Post: 02-19-2003, 12:04 PM
  4. Wasn't thinking when making coordinate programming
    By Garfield in forum Windows Programming
    Replies: 0
    Last Post: 11-17-2001, 05:35 PM
  5. Class rectangle/need help thanks!!!
    By C++Newbie in forum C++ Programming
    Replies: 11
    Last Post: 11-16-2001, 04:00 PM