I am currently attempting to add a "date created" field to the palm address
book. In testing this app based on the sample address app included in CW6,
I get Form.C: 1272 Object not in form when I select the date field to open
the date selector form. It happens when GetObjectPtr is called in
EditViewLoadTable. However, I can't figure out why this is happening. Is
the date selector form the active form and that is why it can't find
EditTable? Could someone help me fix this bug? I have included some of the
code below...I am happy to provide more if it helps...
Thanks.
Clancy J. Clark
static Boolean SelectDateForm(TablePtr tableP, Word row, Word fieldIndex)
{
Err err;
VoidHand currentRecordH;
ArchDBRecordType currentRecord;
ArchDBRecordFlags bit;
SWord mth, day, year;
DateTimePtr dateTimeP;
TimSecondsToDateTime(TimGetSeconds(),dateTimeP);
mth=dateTimeP->month;
day=dateTimeP->day;
year=dateTimeP->year;
ArchGetRecord (ArchDB, CurrentRecord, ¤tRecord,
¤tRecordH);
if (SelectDay (selectDayByDay, &mth,&day,&year, "Select a Day"))
{
Char szDate[20];
StrPrintF (szDate, "%d/%d/%d", mth, day, year);
currentRecord.fields[Date]=szDate;
bit.allBits = (ULong)1 << Date;
err = ArchChangeRecord(ArchDB, &CurrentRecord,
¤tRecord,bit);
if (err)
{
MemHandleUnlock(currentRecordH);
FrmAlert(DeviceFullAlert);
}
return true;
}
}
static Boolean EditViewHandleSelectField (Word row, const Byte column)
{
Err err;
Word currRow;
Word fieldNum;
Word fieldIndex;
VoidHand currentRecordH;
UInt i;
UInt currentField;
FontID currFont;
Boolean redraw = false;
TablePtr tableP;
FieldPtr fldP;
AddrDBRecordType currentRecord;
AddrDBRecordFlags changedFields;
AddrDBRecordFlags bit;
tableP = GetObjectPtr(EditTable);
// If a label was changed then modify the record
currentField = FieldMap[TblGetRowID(tableP, row)];
if (column == editLabelColumn)
{
....
}
.
.
.
// if selected field is date field then open date selector form
if (fieldNum==Date)
{
if(SelectDateForm(tableP, row, fieldIndex))
{
TblMarkRowInvalid (tableP, row);
redraw = true;
}
}
if (redraw)
{
TblReleaseFocus (tableP);
EditViewLoadTable ();
// Problem: GetObjectPtr is called in EditViewLoadTable
TblFindRowID (tableP, fieldIndex, &row);
TblRedrawTable (tableP);
}
...
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/