If 'label' points to garbage before you set the label, the control will display garbage. Make sure 'label' is correct and points to enough memory before copying anything to it. Remember C/C++ doesn't automatically allocate memory to label in the case that DateToDOWDMF tries to stuff too much data into it. Use an intermediate string or calculate the number of bytes label must point to before assigning a value to it. (and don't forget to add 1 for NULL)
----- Original Message ----- From: "Stephen Bentley" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> Sent: Thursday, October 03, 2002 2:23 PM Subject: select trigger woes > I borrowed the following code snipet, the GetObjectPtr function, and the > details form itself from the OS 3.5 datebook example: > > ctl = GetObjectPtr (DetailsDateSelTrigger); > label = (Char *)CtlGetLabel (ctl); // OK to cast; we call CtlSetLabel > DateToDOWDMFormat (details->when.date.month, details->when.date.day, > details->when.date.year + firstYear, sysPrefs.dateFormat, label); > CtlSetLabel (ctl, label); > > but I constantly get GARBAGE in the ctl pointer that is returned. Yet when > I run the complete datebook example project in debug it works fine. > > Can anyone tell me why I can't get a valid pointer on this stupid control? > It's driving me nuts. I seem to always have problems with select triggers. > > Thanks! > > Stephen > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
