<alert comment="newbie using CW9.3" />

I've got an editable field MyFindField that can be up to 80 characters long. 
Also, there is a list with strings that can be used to replace the MyFindField. 
These strings are typically shorter than the contents of MyFindField.

MyFindField: 01234_this_is_a_long_find_field
List:
..zero
..one
..two
..three

When "two" is clicked, I was getting the result of having MyFindField being:
two34_this_is_a_long_find_field

I tried a number of combinations to get this fixed, but my "solution" seems 
less than appropriate. Is there a better series of statements to accomplish 
this than the following?

Int16 curSelIndex = pEvent->data.lstSelect.selection; // is 2
char* selectedStr = m_szListContents[curSelIndex];    // has "two"
Int16 len = StrLen(selectedStr);
MemHandle hFindWords = MemHandleNew(len + 2);
MemPtr pFindWords = MemHandleLock(hFindWords);
StrCopy((char*)pFindWords, selectedStr);
FldSetTextHandle(m_pFindWordsField, hFindWords);
FldDrawField(m_pFindWordsField);
MemHandleUnlock(hFindWords);
MemHandleFree(hFindWords);


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

Reply via email to