> Thanx, this does help, however, I was hoping for some sample code
> which showed how to load a string list (tSTL) and use it.
>
>> > I'm trying to use the above to change the items in a list. However, I
>> > can't figure out how to define the char ** itemsText. I'd like to use
>> > a resource tSTL list, but can't figure it out.
>> >
>From Palm Programming, the Developer's Guide, page 113-114:
typedef struct StrListType {
char prefixString; // we assume it's empty
char numStringsHiByte; // we assume it's 0
char numStrings; // low byte of the count
char firstString[1]; // more than 1-all concated together
} *StrListPtr;
... The easiest way to crate such an array is with
SysFormPointerArrayToStrings. This [system] routine takes a concatenation
of null-terminated strings and returns a newly allocated array that points
to the beginning of each string in the concatenation. ...
static void gStringArrayH = 0;
static void gStringsHandle = 0;
static void MainVeiwInit(void)
{
FormPtr frm = FrmGetActiveForm();
gStringsHandle = DmGetResource('tSTL', MyStringList);
if (gStringsHandle) {
ListPtr list = FormGetObjectPtr(frm, FrmGetObjectIndex(frm,
MainMyList));
StrLstPtr stringsPtr = MemHandleLock(gStringsHandle);
gStringsArrayH = SysFormPointerArrayToStrings(
stringsPtr->firstString, stringsPtr->numStrings);
LstSetListChoices(list, MemHandleLock(gStringArrayH),
stringsPtr->numStrings);
}
}
static void MainViewDeInit(void)
{
if (gStringArrayH) {
MemHandleFree(gStringArrayH);
gStringArrayH = NULL;
}
if (gStringsHandle) {
MemHandleUnlock(gStringsHandle);
DmReleaseResource(gStringsHandle);
gStringsHandle = NULL;
}
}
--
Neil Rhodes
Calliope Enterprises, Inc.
1328 Clock Avenue
Redlands, CA 92374
(909) 793-5995 [EMAIL PROTECTED] fax: (909) 793-2545