Thanks a lot Daniel.
Your code is pretty useful. By the way, I do have a question about this
custom draw function. When do you set it? I men where do use the
LstSetDrawFunction(...). I am using this code to init the list:
static void InitForm(void)
{
frm = FrmGetActiveForm();
numRecords = DmNumRecords(DB);
if (numRecords) {
itemIndex = FrmGetObjectIndex(frm, List);
lst = (ListPtr) FrmGetObjectPtr(frm, itemIndex);
// Get the usable width of the list rectangle.
FrmGetObjectBounds (frm, itemIndex, &lstRect);
lstWidth = lstRect.extent.x - 2;
// Allocate an initial block for the list choices.
ChoicesHandle = MemHandleNew(sizeof(char));
// Lock down the block and set it's initial value to an empty string.
choices = (char *) MemHandleLock(ChoicesHandle);
*choices = 0;
// Build up the choices.
// A sequence of strings packed one after another, one for each
record.
for (itemIndex = 0; itemIndex < numRecords; itemIndex++) {
// Here I retrieve the information for each record and put it one
after the other one
}
// Create an array of pointers from the choices strings.
ChoicesPtrsHandle = SysFormPointerArrayToStrings(choices, numRecords);
// Set the list choices from the array of pointers.
LstSetListChoices(lst, (char **) MemHandleLock(ChoicesPtrsHandle),
numRecords);
}
}
I don't see the exact way of using the LstSetDrawFuncition between this
code. I wonder if you could give me a hand in this. Thanks a lot.
Ariel Barreiro
Movilogic S.A.
Buenos Aires
Argentina