Originally posted by stumon
Thanks, i got it working.
I was only half right, lol. The listbox will now show tabs, but the array does not seem to change those tab positions. I have tried numerous variations of integers and the tabs stay the same. I am looking to set the first tab position to say 24 because it is a Golf Course name that can be any size, the rest of the information will be integers of 2 or 3 digits. between 60 and 140. So its just the first position i want to set far out to the right, so any course name will fit. Here is what i have tried so far, and the listbox it set to use the LBS_USETABSTOPS style.
Code:
int tabStops[4] = {24, 4, 4, 4};
int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_COURSE_NAME));
int len2 = GetWindowTextLength(GetDlgItem(hwnd, IDC_SCORE));
int len3 = GetWindowTextLength(GetDlgItem(hwnd, IDC_SLOPE));
int len4 = GetWindowTextLength(GetDlgItem(hwnd, IDC_COURSE_RATING));
// allocate memory for the strings (edit boxes)
char *buf = (char *)GlobalAlloc(GPTR, len + 1);
char *buf2 = (char *)GlobalAlloc(GPTR, len2 + 1);
char *buf3 = (char *)GlobalAlloc(GPTR, len3 + 1);
char *buf4 = (char *)GlobalAlloc(GPTR, len4 + 1);
//get text from edit boxes and store in memory.
GetDlgItemText(hwnd, IDC_COURSE_NAME, buf, len + 1);
GetDlgItemText(hwnd, IDC_SCORE, buf2, len2 + 1);
GetDlgItemText(hwnd, IDC_SLOPE, buf3, len3 + 1);
GetDlgItemText(hwnd, IDC_COURSE_RATING, buf4, len4 + 1);
SendMessage(hwnd, LB_SETTABSTOPS, 1, (LPARAM)tabStops);
char *fullString = (char *)GlobalAlloc(GPTR, (len + len2 + len3 + len4 + 10));
strcat(fullString, buf);
strcat(fullString, "\t");
strcat(fullString, buf2);
strcat(fullString, "\t");
strcat(fullString, buf3);
strcat(fullString, "\t");
strcat(fullString, buf4);
SendDlgItemMessage(hwnd, IDC_SCORES_LIST, LB_ADDSTRING, 0, (LPARAM)fullString);