I have strings separates with chr(9) in a record and this works fine:
static Boolean CreaEtiquetasList (void)
{
ListPtr lst;
CharPtr selectionText;
UInt textLen,i;
CharPtr choicesEtiquetasP;
VoidHand choicesEtiquetasH;
VoidHand choicesEtiquetasPtrsHandle;
UInt numEtiquetas = 0;
if (!(PedidosLineasDBCurrentArticulo.Etiquetas)) return false;
textLen = StrLen(PedidosLineasDBCurrentArticulo.Etiquetas);
choicesEtiquetasH = MemHandleNew(textLen+1);
if (choicesEtiquetasH!=NULL)
{
choicesEtiquetasP = MemHandleLock(choicesEtiquetasH);
for (i = 0; i < textLen; i++)
{
if (PedidosLineasDBCurrentArticulo.Etiquetas[i] == 9)
{
choicesEtiquetasP[i] = '\0';
numEtiquetas++;
}
else choicesEtiquetasP[i] =
PedidosLineasDBCurrentArticulo.Etiquetas[i];
}
choicesEtiquetasP[textLen++] = 0;
numEtiquetas++;
choicesEtiquetasPtrsHandle =
SysFormPointerArrayToStrings(choicesEtiquetasP, numEtiquetas);
lst = GetObjectPtr (PedidosDetalleEtiquetasList);
LstSetListChoices(lst, MemHandleLock(choicesEtiquetasPtrsHandle),
numEtiquetas);
}
return true;
}
Amadeu
> De: "Rob Graber" <[EMAIL PROTECTED]>
> Responder a: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Fecha: Wed, 26 Apr 2000 09:34:32 -0500
> Para: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Asunto: 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