Sorry about that, Remo -- I read through your code too quickly. And, of
course, I don't have any info on what will happen in Palm OS 5.
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Remo
> Hofer
> Sent: Wednesday, February 07, 2001 10:44 AM
> To: Palm Developer Forum
> Subject: Re: update control label
>
>
> In article <38669@palm-dev-forum>, "Richard Burmeister" <[EMAIL PROTECTED]>
> wrote:
>
> > > From: Remo Hofer
> > >
> > > Could you please comment the following function:
> > >
> > > void UpdateControl(FormPtr f, UInt16 id, Char * s) {
> > > ControlType *ctl;
> > > Char *label;
> > >
> > > ctl = FrmGetObjectPtr(f, FrmGetObjectIndex(f, id));
> > > label = (Char *) CtlGetLabel(ctl);
> > > StrCopy(label, s);
> > > CtlSetLabel(ctl, label);
> > > }
> >
> > label is a stack-based (local) variable in the function
> UpdateControl. As
> > soon as you exit UpdateControl, it's contents may change. This is not a
> > good way to change the label of a control which will probably
> outlive the
> > function call.
>
> The address of the persistent (global) memory of the controls label (which
> lives in the memory allocated by the form) is stored in the local variable
> label. And then after tweaking the string, this address (still pointing
> into the forms memory) will be set (once again) as the new label location,
> just to tell the system that the string has changed and has to be redrawn.
> The string itself stays allways in the forms memory. This method works
> fine on PalmOS 2 upto 4 (also debug), but I wonder if it is clean enough
> for PalmOS 5.
> --
> Remo Hofer <[EMAIL PROTECTED]>
> http://www.geocities.com/SiliconValley/Cable/5206/
>
> --
> 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/