Hi, all. A couple of people helped me get a custom draw routine together
for a list. I now have a list with 8 visible items, and the list is
composed of 8 items. I am able to select items in the list and they are
highlighted. There is a downward-pointing arrow at the bottom of the
list. However, tapping on it does not move the list at all. Only 8 items
are visible as defined in Constructor, and I have verified that the list
does indeed consist of 12 items by getting the return value of
LstGetNumberOfItems. I have also confirmed that it is the first item
that starts out as being selected by using the LstGetSelection function.
I have set a breakpoint in CodeWarrior in my custom draw function, and I
am observing that my code goes through items 0 - 7 and then starts back
again at 0 and goes to 7 again. This seems odd, as I would think it
would go through the number of items only once and would go on up to
element 11 (12 items). Below are relevant portions of my code. Does
anyone see anything in my code that could be producing this odd behavior
or inhibiting the scroll functionality? Thank you for any ideas.

Err DatabaseToMemory(OrderTypeInDBPtr& in, OrderTypeInMemoryPtr& out)
{
    Err error = 0;
    MemPtr temp = &out->orderHeadID;
    Char* rec = in->cust;
    MemMove(temp, rec, sizeof(Int32));
    rec += sizeof(Int32);
    out->custNum = rec;
    rec += StrLen(rec) + 1;
    out->poNum = rec;
    rec += StrLen(rec) + 1;
    out->status = rec;
    rec += StrLen(rec) + 1;
    out->userID = rec;
    rec += StrLen(rec) + 1;
    temp = &out->orderDate;
    MemMove(temp, rec, sizeof(Int32));
    return error;
}

void DrawOneString(Int16 itemNum, RectangleType * bounds, Char**
itemsText)
{
        Err error;
        DateTimeType dt;
        Char** listItem;
        MemHandle poRecordHan = MemHandleNew(sizeof(OrderTypeInDB));
        MemHandle inMemHan = MemHandleNew(sizeof(OrderTypeInMemory));
        OrderTypeInDBPtr inDBPtr =
(OrderTypeInDBPtr)MemPtrNew(sizeof(OrderTypeInDBPtr));
        OrderTypeInMemoryPtr inMemPtr =
(OrderTypeInMemoryPtr)MemPtrNew(sizeof(OrderTypeInMemoryPtr));
        UInt16 numRecs = DmNumRecords(dbOrderPending);
        poRecordHan = DmQueryRecord(dbOrderPending, itemNum);
        inDBPtr = (OrderTypeInDBPtr)MemHandleLock(poRecordHan);
        inMemPtr = (OrderTypeInMemoryPtr)MemHandleLock(inMemHan);
        error = DatabaseToMemory(inDBPtr, inMemPtr);
        TimSecondsToDateTime(inMemPtr->orderDate, &dt);
        listItem = (Char**)MemPtrNew(StrLen(inMemPtr->custNum) +
StrLen(inMemPtr->poNum) + dateStringLength + 2  listItem[0] =
inMemPtr->custNum;
        listItem[1] = inMemPtr->poNum;
        Char* theDate = (Char*)MemPtrNew(dateStringLength);
        DateToAscii(dt.month, dt.day, dt.year, dfMDYWithSlashes,
theDate);
        listItem[2] = theDate;
        Char* s = listItem[0];
        WinDrawChars(s, StrLen(s), bounds->topLeft.x,
bounds->topLeft.y);
        bounds->topLeft.x += 25;
        s = listItem[1];
        WinDrawChars(s, StrLen(s), bounds->topLeft.x,
bounds->topLeft.y);
        bounds->topLeft.x += 50;
        s = listItem[2];
        WinDrawChars(s, StrLen(s), bounds->topLeft.x,
bounds->topLeft.y);
        bounds->topLeft.y += 12;
        MemHandleUnlock(poRecordHan);
        bounds->topLeft.x = 12;
}

static void MainFormInit(FormPtr /*frmP*/)
{
        Err error;
        ListPtr poList = (ListPtr)GetObjectPtr(MainLstOrdersList);
 (RectanglePtr)MemPtrNew(sizeof(RectangleType));
        error = OpenDatabases();
        UInt16 numRecs = DmNumRecords(dbOrderPending); // Will return 12
in my case.
        LstSetDrawFunction(poList, DrawOneString);
        LstSetListChoices(poList, NULL, numRecs);
        if(error == errNone)
        {
                if(numRecs != 0)
                        LstDrawList(poList);
                Int16 num = LstGetNumberOfItems(poList); // Returns 12
                Int16 selected = LstGetSelection(poList); // Returns 0
        }
}

Robert C. Brinson
Programmer/Analyst
DaySpring Cards
[EMAIL PROTECTED]

--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to