Mauricio Tavares wrote in message <33310@palm-dev-forum>...
>
>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?
>
>
>

According to the docs, what you'll get back is "the prefix string appended
with the designated index string".  Looks like "moose bit my sister" is
considered to be your prefix string, and you have an actual string list
of 2 entries.  The entries are 0 based.  If you used StrLen() instead of
SizeOf() you would probably see

    moose bit my sisterMinistry of silly walks

if you asked for string #0, and

    moose bit my sisternights who say ni

if you asked for string #1.

--
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi/sec: not just a good idea, it's the LAW!




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

Reply via email to