You are actually overwriting the memory owned by the control for that label,
hence you cannot write a string larger than the original label string to the
label.
Hope this helps,
Kevin
> -----Original Message-----
> From: Qun Wang [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 27, 1999 11:51 PM
> To: Palm Developers Forum List
> Subject: CtlGetLabel and CtlSetLabel Question,
>
>
> Hi, All, I have a question regarding the memory management on
> the labels
> that associate with popup triggers or select triggers. When I
> programmactically set the labels I encountered some problems.
> Code looks like this:
> tmpStr1 =CtlGetLabel(GetObjectPtr(PopTrigger1));
> CtlSetLabel(GetObjectPtr(PopTrigger1), anotherStr);
> What happened to tmpStr1? is there a memory leak hazard here?
> If the code looks like this:
> tmpStr1 =CtlGetLabel(GetObjectPtr(PopTrigger1));
> StrCopy(tmpStr1, anotherStr);
> CtlSetLabel(GetObjectPtr(PopTrigger1), tmpStr1);
> When the anotherStr is longer than the tmpStr1, I got all
> kind of weird
> problems, like the labels for the other selecttriggers in the
> same form
> disappeared, or get over-written.
>
> So what is the rule of thumb dealing with CtlLabels?
>
> Thanks,
>
>