I've been having the darndest time trying to get a ListBox to fill with data for me. The code looks like this:
The message box call assures me that the strings are being fed as I want them to be, and the return value from the ADDSTRING is always 0. Further, the j variable is also always 0, regardless of the number of strings in schemes->pointer. It's got to be something simple; I've messed with all the hard parts. It started out as a ComboBox with the same results; I switched to a ListBox so I could better see what was happening.
Code:
static void BuildSchemeMenu()
{
InitCommonControls(); // just to make sure this is not a problem.
SendMessage (schemeControl, LB_RESETCONTENT, 0, 0);
for (int i = 0; i < schemes->pointer; i++) {
int j = (int) SendMessage (schemeControl, LB_ADDSTRING, 0, (LPARAM) (schemes->GetScheme (i)->name));
XBox (MB_OK, "returned value %d, string is '%s'", j, schemes->GetScheme (i)->name);
}
int j = (int) SendMessage (schemeControl, LB_GETCOUNT, 0, 0);
The message box call assures me that the strings are being fed as I want them to be, and the return value from the ADDSTRING is always 0. Further, the j variable is also always 0, regardless of the number of strings in schemes->pointer. It's got to be something simple; I've messed with all the hard parts. It started out as a ComboBox with the same results; I switched to a ListBox so I could better see what was happening.