Probably you should use StrLen in place of sizeof
-----Original Message-----
From: Mauricio Tavares [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 15, 2000 2:52 PM
To: Palm Developer Forum
Cc: Palm Developer Forum
Subject: Correction to: Re: Stupid string list question
At 10:40 AM 12/15/00 -0600, you wrote:
>From: "Mauricio Tavares" <[EMAIL PROTECTED]>
>
>> and convert to the list object so it can be shown. But, what I want is
to
>> read in the string list and then select one of its entries and then print
>> it. Can't I just get it off the string list or should I convert it to a
>> list first?
>
>Create the string list as a resource (in Constructor), then use
>SysStringByIndex() to retrieve one of the strings from the list.
>
Richard,
I looked at the Palm OS SDK Reference, and saw the format for this
function is
Char* SysStringByIndex (UInt16 resID, UInt16 index, Char* strP, UInt16
maxLen)
>From what I understood, resID is the resource ID for the string list, index
is the string #, strP is a string that is there just as a placeholder in
memory so SysStringByIndex has a place to put its return argument.
As a quick and dirty but not very elegant test, I wrote the following
function:
static void DrawOneListItem(void)
{
CharPtr theString;
Char theStringPtr[255];
theString = SysStringByIndex(stringQuotes, 2, theStringPtr, 255);
WinDrawChars(theString, sizeof(theString), 1, 130);
}
Where my string list looks like this in my .rcp file:
STRINGTABLE stringQuotes
"moose bit my sister" "Ministry of silly walks" "nights who say ni"
When I try the above routine, shown above asking for the 3rd string
(index=2), what I get is "moose", nothing else. So, that would make me
think that no matter what I fed to index, theString ends up always being
the first word in the first string. Would you have an idea why? Could I
be passing the wrong arguments? Why does theString only contain the first
string up to the first blank space?
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/