Ok. I've posted somewhat on this problem earlier. However, I've learned
some new things since then. First of all, my list is successfully drawn
with all of my columns correctly spaced. I can also actually tap on and
select items from the list. There are 12 items in this list, and I've
set up the list with Constructor so that it will only display up to 8
items at a time. However, I was not seeing a scrollbar. There was a
downward pointing arrow below the list on the right hand side that did
nothing when tapped. At first, I thought scrolling simply wasn't
working. However, when I tapped on an item and dragged down, my list
started scrolling down to the last item. I also noticed that while I was
scrolling, I could see that there was an upward pointing arrow that was
somehow underneath the list. So, it appears the positioning of the
scrollbar is shifted horizontally to the left and vertically down by
about one row. This has the effect of covering up the scrollbar except
for the downward pointing arrow. At first, I thought that this meant
that my list box was too wide. So, I made it narrower, but I still got
the same result. Has anyone noticed this behavior before with the
scrolling function of a List object? Below is relevant source from the
project I'm working on.
// Unpacked Order Header record in memory.
typedef struct
{
Int32 orderHeadID;
Char* custNum;
Char* poNum;
Char* status;
Char* userID;
Int32 orderDate;
Char* termsCD;
Char* deliveryNote;
} OrderTypeInMemory;
typedef OrderTypeInMemory* OrderTypeInMemoryPtr;
// Packed Order Header record straight from database.
typedef struct
{
Char cust[1];
} OrderTypeInDB;
typedef OrderTypeInDB* OrderTypeInDBPtr;
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 = errNone;
UInt32 offset;
DateTimeType dt;
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);
offset = 0;
dt.second = 0;
dt.minute = 0;
dt.hour = 0;
dt.day = 1;
dt.month = 1;
dt.year = 1980;
offset =TimDateTimeToSeconds(&dt);
inMemPtr->orderDate += offset;
TimSecondsToDateTime(inMemPtr->orderDate, &dt);
Char* theDate = (Char*)MemPtrNew(dateStringLength);
DateToAscii(dt.month, dt.day, dt.year, dfMDYWithSlashes,
theDate);
WinDrawChars(inMemPtr->custNum, StrLen(inMemPtr->custNum),
bounds->topLeft.x, bounds->topLeft.y);
bounds->topLeft.x += 32;
WinDrawChars(inMemPtr->poNum, StrLen(inMemPtr->poNum),
bounds->topLeft.x, bounds->topLeft.y);
bounds->topLeft.x += 35;
WinDrawChars(theDate, StrLen(theDate), 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);
error = OpenDatabases();
UInt16 numRecs = DmNumRecords(dbOrderPending);
LstSetDrawFunction(poList, DrawOneString);
LstSetListChoices(poList, NULL, numRecs);
if(error == errNone)
{
if(numRecs != 0)
LstDrawList(poList);
}
}
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/