On 04 Aug 2003 14:55:54 +0100, kcorey <[EMAIL PROTECTED]> wrote:

>
>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.
That's not dynamic.

>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.

>3) Open all the records, and lock them in place while the list is on the
>form.

What?

>
>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.

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'? 

>Using a custom-drawn list gets around this nicely, 

It gets around a problem that doesn't really need solving.

>and it's a piece of
>cake, 

So is LstSetListChoices. Quite a bit easier, in fact.

> also giving you the ability to draw graphics, change fonts, or do
>whatever bit of wizardry you'd like in the list.

That's not 'wizardry', but if you need icons or funny fonts,
a custom Drawlist is the way to do it. That is what it's for.

>Besides, do it once, and the code for the custom drawn list become
>boiler plate, as the functionality is quite similar.

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.

But it's your program, do as you like.

bullshark

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

Reply via email to