You are overwriting form memory. In particular, DateToDOWDMFormat simply writes a, perhaps obnoxiously long, string to the Char* it is passed, without doing any bounds checking. In this case, it is label, which is a pointer to an area in the Form's memory which contains a copy of the label as it was defined in the resource. The DateToDOWDMFormat function writes beyond the bounds of the label and clobbers other vital areas of the form's memory -- effectively lobotomizing it.
To fix this you can either (1) define the control's label to contain at least as many characters as you will ever put into it via this method, or (2) allocate (and later de-allocate) your own memory to hold the trigger's label and then give it to the trigger. -----Original Message----- From: Stephen Bentley [mailto:[EMAIL PROTECTED]] Sent: Friday, October 11, 2002 6:51 AM To: Palm Developer Forum Subject: Form goes bye-bye after SelectDay Greetings from GA. I witnessed a strange occurance using SelectDay so I created a brand new clean project in Codewarrior. Slapped one button and a select trigger on the main form that calls this logic: case MainDateSelTrigger: title = MemHandleLock(DmGetResource (strRsc, SetReviewDateString )); if (SelectDay (selectDayByDay, &month, &day, &year, title)) { ctl = GetObjectPtr (MainDateSelTrigger); label = (Char *)CtlGetLabel (ctl); DateToDOWDMFormat (month, day, year, sysPrefs.dateFormat, label); CtlSetLabel (ctl, label); } MemPtrUnlock (title); handled = false; break; It seems that after calling SelectDay, my form no longer responses to events correctly. For instance, the button no longer works, yet it does prior to tapping the select trigger. Any ideas on this would be GREATLY appreciated. Stephen [EMAIL PROTECTED] -- 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/
