On Mon, 2003-08-04 at 14:53, bullshark wrote: > On Mon, 4 Aug 2003 09:59:53 +1000, "Alan Ingleby" <[EMAIL PROTECTED]> wrote: > > > >Ken's right. Specifically, you *can't* use LstGetSelectionText with a > >dynamic list, so don't. > > What? Why would that be? That's just wrong. > > This is only the case when a (suspicious) program never calls LstSetListChoices. > I think there is foul play here. [...] > If all that is involved here is a dynamic list, a DrawList callback > is the wrong way to do it. You would only resort to this if your list > had to display little icons or something. Even if you are doing it the > wrong way, LstSetListChoices should still be called unless the list > items don't have any text.
It all depends on where your strings come from. Lately, I've done a bunch of work on lists built up from strings that are individual records in a database. If I wanted to be able to use LstSetListChoices, I'd need to either 1) Have a String array. 2) Allocate an array from dynamic memory for the strings and copy all the strings into memory. 3) Open all the records, and lock them in place while the list is on the form. All of these take up some amount of space. Arguably, if you're only going to display 10 items, big woop. If you're going to display up to 100, now you're potentially chewing up large amounts of memory. Using a custom-drawn list gets around this nicely, and it's a piece of cake, also giving you the ability to draw graphics, change fonts, or do whatever bit of wizardry you'd like in the list. Besides, do it once, and the code for the custom drawn list become boiler plate, as the functionality is quite similar. -Ken -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
