When I click on the field in my form, it brings up the date selection
screen. If I click on it again, it causes the error.
However, if I move between forms before I click it a 2nd time, the error
doesn't appear. I figure that it has to do with the obvious.. an object
isn't in the form... or more appropriate, it believes that it isn't.
Any ideas would be appreciated.
/******** Starting call *************/
handled = SetStartDate(index); // index = an UInt parameter
/******** Middle function *************/
Boolean SetStartDate(Int index)
{
tblInfo theInfo;
tblPackedInfoPtr p;
DateTimeType date;
VoidHand record;
// Query the record
record = DmQueryRecord(gInfoDB, index);
// Lock the record
p = MemHandleLock(record);
// Unpack the record
UnpackInfo(&theInfo, p);
// Assign variables to default variable
date.year = theInfo.StartDate.year;
date.month = theInfo.StartDate.month;
date.day = theInfo.StartDate.day;
// Unlock the record
MemHandleUnlock(record);
// Return the results from the Prompt for date function
return(PromptForDate(NfoStartofTripDateField, index, &date));
}
/******** End function *************/
Boolean PromptForDate(Word fldID, Int index, DateTimePtr date)
{
CharPtr txt;
Char endString[dateStringLength];
DateTimeType dateTime; // Today!!
DateTimeType curDate; // Receives initDate info
txt = FldGetTextPtr(GetObjectPtr(fldID)); file://***** I'm suspecting
the error is here...
// If there is a date in the field
if(txt)
{
curDate.year = date->year;
curDate.month = date->month;
curDate.day = date->day;
}
// or set the current date to be the date
else
{
// Retrieve the Date
TimSecondsToDateTime(TimGetSeconds(),&dateTime);
// Set the curDate based on the results from the retrieval
curDate.year = dateTime.year;
curDate.month = dateTime.month;
curDate.day = dateTime.day;
}
// Let's pop up the Calendar and make our pick - initialized to the
current Date's value
if(SelectDay(selectDayByDay, &curDate.month, &curDate.day,
&curDate.year, "Choose the Date"))
{
// Set the Date to be the "picked" date
DateToAscii(curDate.month, curDate.day, curDate.year,
dfMDYWithSlashes, endString);
// Let's put this puppy in the edit field
SetFieldTextFromStr(fldID, endString);
return(true);
}
return(false);
}
--
Tim Astle
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/