Use a dynamically drawn list. It's actually very easy. Here are a few
snippets from an application I wrote, Pocket Library:

First, in the init code for the form:

    // open the db
    afdb = DmOpenDatabaseByTypeCreator (aftyp, appFileCreator,
dmModeReadOnly);
    afListCount = DmNumRecordsInCategory(afdb, dmAllCategories);

    // setup the list
    listP = GetObjectPtr(AEFList);
    LstSetDrawFunction(listP, AFEditDraw);
    LstSetListChoices(listP, NULL, afListCount);

Now, here's the AFEditDraw callback function:

static void AFEditDraw(Int16 itemNum, RectangleType *bounds, Char
**itemsText) {
MemHandle       rH;
LookupRecordPtr rP;

    rH = DmQueryRecord(afdb, itemNum);
    rP = MemHandleLock(rH);
    WinDrawChars(&rP->text, StrLen(&rP->text), bounds->topLeft.x,
bounds->topLeft.y);
    MemHandleUnlock(rH);
}

See? Piece of cake!

"Marco Pantaleoni" <[EMAIL PROTECTED]> wrote in message
news:73970@palm-dev-forum...
>
> Hi,
> I'm new to Palm OS programming, and I need to implement browsing
> functionality for a DB with a large number of records (about 20,000).
> The records should be displayed as a scrollable list of strings.
> Clearly I don't want to allocate storage in memory for all the strings.
> I'm wondering if The Right Thing is using a List control (without
> actually allocating the strings for all the records, but by resorting
> to LstSetDrawFunction()), or a single-column Table control with custom
> drawn labels.
> Your opinion and experience on the subject would be very appreciated.
> Thanks in advance.
>
> Cheers,
> Marco
>
> --
> ========================================================================
> Marco Pantaleoni                                  [EMAIL PROTECTED]
> Padova, Italy                                              [EMAIL PROTECTED]
> elastiC language developer                   http://www.elasticworld.org
>
>



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

Reply via email to