At 07:35 PM 10/26/2004, you wrote:
Hi thanks for taking a look. only the hardware devices have been giving me trouble (code below)
The odd thing about this is that it works on OS 5 devices, forces a soft reset on OS 4 devices, and has a fatal exception on OS 3.5 devices. I am obviously trying to find a solution that fits all three.
My general idea is to take a field of text, and assign it a new value based on a user entered date. I have been able to convert the date to a string, but putting that string into the text box has some odd affects. This all works properly on the emulators, only the hardware devices have been giving me trouble.
I am trying to set a text field's text equal to a string
Note: I have a form set up with a textbox ID = TXTSTARTDAY.
//assign fldStartDay object FieldType *fldStartDay; GetObjectPtr (fldStartDay, TXTSTARTDAY);
//this puts a string with the date into gc6DaysPriorDate DateToAscii (dt6DaysPrior->month, dt6DaysPrior->day, dt6DaysPrior->year + 1904, dfMDYLongWithComma, gc6DaysPriorDate);
//this should assign the string from gc6... to fldStartDay. FldSetTextPtr(fldStartDay, gc6DaysPriorDate);
//redraw object FldDrawField(fldStartDay);
Two questions:
1) Where is gc6DaysPriorDate allocated? Is it a global character array? Is it a memory chunk allocated using MemPtrNew or MemHandleNew? Is it a local array on the stack? The memory that gc6DaysPriorDate points to has to remain valid as long as the field is around.
2) Is the field a read-only field? FldSetTextPtr only works for read-only fields. If it is editable, you need to use a handle and the FldSetTextHandle call.
-- Ben Combee, Technical Lead, Developer Services, PalmSource, Inc. "Combee on Palm OS" weblog: http://palmos.combee.net/ Developer Fourm Archives: http://news.palmos.com/read/all_forums/
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
