Okay when I call the ListView_GetSubItemRect() it returns the co-ordinates, however, my co-ords are not correct. Using the RECT that is filled by the ListView_GetSubItemRect() call I am creating an editbox (supposed to be created at the location and be the size of the subitem I used during that call) for user input. However, when the editbox is created it is created in a manner that it is about 10 - 15px above where it should be (for location) and if the subitem happens to be (0,0) in the ListView then it's length is created matching the length of the ListView, however, if the item is (0,1) or otherwise, then it is created with the right length to match the column.
Can anyone help me with this issue?
Here is some code:
Code:
// get ready for user input
err = ListView_GetSubItemRect(expHwnds.hLV_Wnd, 0, 0, LVIR_BOUNDS, &rect);
if( err == 0 )
{
sprintf(error, "Unable to get dimensions of first item. %u", GetLastError());
MessageBox(NULL, error, "Error", MB_ICONEXCLAMATION);
return(-1);
}
else
{
expHwnds.hEdit = CreateWindow("EDIT", "MM/DD/YYYY", WS_CHILD | WS_BORDER | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, hwnd, NULL, g_hInst, NULL);
if( expHwnds.hEdit == NULL )
{
sprintf(error, "Unable to initialize user input for Expense module. (Error 0027; %u)", GetLastError());
MessageBox(NULL, error, "Error", MB_ICONEXCLAMATION);
return(-1);
}
}
I'm not sure exactly why this is happening. Probably something very simple and stupid (maybe I should try sleep to remedy my problems? lol let me know, maybe that would be a solution!)
Tyouk