Thanks to everyone that responded.  Your code definitely helped!

My basic problem had to do with not having the correct type for the second
parameter of the LstSetListChoices call.  Once I got that fixed, all went
well!

Very truly yours,

Rob G.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Eric
Sent: Wednesday, April 26, 2000 10:54 AM
To: Palm Developer Forum
Subject: RE: LstSetListChoices


Hello Rob,

I have a similar situation and basically iterate through a database and grep
strings.

Here is an example - for string char(9):
        VoidHand LstH = MemHandleNew(1);
        VoidHand H;
        Char *tmp;
        int i, k = 0;
        while (still more strings) {
                determine if the string is valid(I can handle that part
myself)
                if (valid) {
                k ++;
                if (MemHandleResize(lstH,10 * k) == 0) {
                //if can be resize, add the next string
                        tmp = MemHandleLock(lstH);
                        for (i = 1; i < k; i++)         tmp += StrLen(tmp) +
1;
                        StrNCat(tmp, value, 10);                //value =
value from database
                        MemHandleUnlock(lstH);
                }  else {
                //if cannot resize, just dump out what you got
                        k--;
                        break;
                }  //if
                next string
        }
H = SysFormPointerArrayToString(MemHandleLock(lstH),k);
MemHandleUnlock(lstH);
LstSetListChoices(LstPtr, MemHandleLock(H), k);
MemHandleUnlock(H);

Hopes this helps.
Eric Sun
Developer - RAD systems
Q. Data Inc.
4/26/00 11:31 AM

        -----Original Message-----
        From:   Rob Graber [SMTP:[EMAIL PROTECTED]]
        Sent:   Wednesday, April 26, 2000 10:35 AM
        To:     Palm Developer Forum
        Subject:        LstSetListChoices

        Here is the deal.  I have a database with a record containing a
bunch of
        NULL-terminated strings.  Some of the strings are valid for
inclusion in my
        listbox, others are not.  I want to write some code that will do the
        following.

        while (still more strings) {
                determine if the string is valid(I can handle that part
myself)
                if (valid) {
                        write a pointer value to the
                        beginning of the string to the end of
                        a record in the database (essentially
                        create a record that is an array of
                        character pointers)
                }
                next string
        }

        //now that there is a record containing an array of character
pointers..
        LstSetListChoices(listP, itemsText, numStrings);

        My problem is that I can't seem to figure out the
declarations/syntax to set
        and pass the itemsText variable.  Any ideas?  Anyone already done
something
        similar they can share?

        I am attaching the SDK ref for LstSetListChoices for convenience.

        Very truly yours,

        Rob G.


        Prototype void LstSetListChoices (ListPtr ListP,
        char ** itemsText, UInt numItems)
        Parameters ListP Pointer to a list object.
        itemsText Pointer to an array of text strings.
        numItems Number of choices in the list.
        Result Returns nothing.


        --
        For information on using the Palm Developer Forums, or to
unsubscribe, please see http://www.palm.com/devzone/mailinglists.html

--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to