>  (const Char*)endTime=
>CtlGetLabel(GetObjectPtr(ServicePeriodEndSelTrigger));
>  TimeToAscii(gCurrentRecord.end.hour,
>gCurrentRecord.end.minute,sysPrefs.timeFormat, endTime);
>  endlbl = MemPtrNew(StrLen(endTime)+1);
>  StrCopy(endlbl, endTime);
>  CtlSetLabel(GetObjectPtr(ServicePeriodEndSelTrigger),endlbl);
> }

I'm pretty sure the problem is that you're calling TimeToAscii, putting the
results into endTime, but not making sure that endTime is a big enough
buffer to fit the time value... it is only as big as whatever was in the
trigger before.

Do a MemPtrNew to allocate a buffer of at least "timeStringLength" bytes,
then call TimeToAscii, then call CtlSetLabel.  More efficient and correct
too, how about that? :-)  (Don't forget to free the memory that you
allocate, though...)

-David Fedor
Palm, Inc.

-- 
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