On Tue, 2003-08-05 at 10:43, bullshark wrote: > >2) Allocate an array from dynamic memory for the strings and copy all > >the strings into memory. > > That's the ticket. 'Dynamic'. Copy is what you do when you draw. > The difference is that with a LstSetListChoices you have access to the > list after you create it.
So you're saying that it's better to allocate n blocks of memory, populate these blocks in some way, grab pointers to all of them, and then call LstSetListChoices? (Don't forget, then you have to worry about deallocation when the form exits.) If you have a small number of list items, it works well enough I imagine. If you have a large number, it certainly doesn't sound easier to me than custom draw lists. You have to allocate space, clear the space, copy the strings to it, and then hand the pointers to LstSetListChoices, not to mention remembering to deallocate the memory. I'd rather not clutter up dynamic memory with any more locked blocks than I must. > No, you're not chewing up 'large amounts' of memory, and what is the > memory for anyway? Do you think your program is 'better' if it leaves > the heap unutilized'? It's quite simple: you're less likely to run out of memory if you're careful of your memory requirements. Until your program is done, you're never sure exactly how much memory it will require. Why burn memory when you don't need to? There's not enough dynamic memory on the Palm as it is. > So is LstSetListChoices. Quite a bit easier, in fact. You're not taking into account allocation/assigning strings/deallocation. That doesn't sound remarkably easier to me unless you're forced to keep the strings in dynamic memory already for whatever reason. > Not as boiler plate as LstSetListChoices(). Your code is a maintenance > chore. Building a list for LstSetListChoices is a piece of cake. > It is so 'boiler-plate' that a single subroutine, written once, lib'd > and never touched again will do for most applications. *smile* I'm glad you've found a solution that works for you. > But it's your program, do as you like. Well, gosh, thanks, that's mighty big of you. -Ken -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
