Static is necessary for the label text pointer. CtlSetLabel() stores the
new label pointer in the control's data structure. It does not make a copy
of the text. Take a look at the comments under CtlSetLabel() in Palm OS
SDK Reference (SDK 4.0).
-Elizabeth
Mark Smith <[EMAIL PROTECTED]>
Sent by: To: Palm Developer
Forum
bounce-palm-dev-forum-8072@news.
<[EMAIL PROTECTED]>
palmos.com cc:
Subject: Re: Question
on CtlGetLabel()
08/09/01 07:05 AM
Please respond to Palm Developer
Forum
[EMAIL PROTECTED] wrote:
>Thank you for clarifying. After spending almost an hour studying the
>comments under CtlGetLabel, I have a better understanding of setting and
>getting label text from the Selector control. Since CtlSetLabel() uses
>pointer to a string, this pointer should persists during the life of the
>Form object. Hence, use STATIC variable for the pointer.
The memory pointed to would persist even if the variable wasn't
static, because it's been allocated from the heap. Saving it in
a static variable keeps a reference around so you can free it later
when the form is destroyed. I don't think that's even necessary
though, since you can just call CtlGetLabel() to get back the pointer.
--
-M- [EMAIL PROTECTED]
--
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/
- Re: Question on CtlGetLabel() Chang . Elizabeth
- RE: Question on CtlGetLabel() Scott Johnson (Bellevue)
- RE: Question on CtlGetLabel() Peter Epstein
- RE: Question on CtlGetLabel() Chang . Elizabeth
- RE: Question on CtlGetLabel() Chang . Elizabeth
- RE: Question on CtlGetLabel() Igor Mozolevsky
- RE: Question on CtlGetLabel() Chang . Elizabeth
- RE: Question on CtlGetLabel() Igor Mozolevsky
- RE: Question on CtlGetLabel() Chang . Elizabeth
- Re: Question on CtlGetLabel() Mark Smith
- Re: Question on CtlGetLabel() Chang . Elizabeth
- Re: Question on CtlGetLabel() Mark Smith
