> -----Original Message-----
> From: Régis Daniel de Oliveira
> Sent: Friday, August 01, 2003 2:59 PM
> 
> Does anybody know which is the best way to fill a list with a 
> lot of itens?

I know! I know!

First, go here:
        
http://www.palmos.com/dev/support/docs/recipes/lists.html#dynamic

Scroll down to "Custom Drawn Lists" -- that'd be your list.  Only,
instead of TimesDrawCallback(), you would 

0) Open "SAF_PRODUTOS" (may be more efficient just to keep it open for
the life of the form on which the list appears)

1) Call DmQueryRecord() to get the record that corresponds to the
"itemNum" parameter that the OS passes your callback.  Lock down the
record, pass the record's string that should be drawn in your list to
WinDrawChars(), and unlock the record.

2) Close "SAF_PRODUTOS" (again, maybe you want to keep it open)

That's it.  The problem I see with your code is that it's allocating the
a big chunk of memory to hold the strings that will show up in the list.
This works for lists with a dozen or so items, but for anything larger
than that, you want ot use a custom-drawn list callback.  That way, you
only open one record at a time and you never have to allocate a big
chunk of memory to hold strings.

-Jeff Ishaq


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

Reply via email to