I have two selector triggers on a single form. One is used to set a start
time and the other an end time. The code below correctly sets the trigger
labels to the corresponding times in the database. However, if the "Move
start time to screen" section is moved ahead of the "Move end time to
screen", I get an "Object not in form" error for the
CtlGetLabel(GetObjectPtr(ServicePeriodEndSelTrigger)); command. The only
difference is which section of code is before the other.
Best I can tell, the selector buttons are identical with the exception of
the control name and the lable defined in Constructor.
In addition to the above controls, I have 6 editable fields, 1 non editable
field, labels for each field, and a cancel button. Not sure if that matters,
but I wanted everyone to have as much info as possible.
Any ideas.
Thanks,
Todd
Char *startTime;
Char *endTime;
static Char *startlbl;
static Char *endlbl;
// Move end time to screen
// If new record with no end time, use default label label; else end time
if (gCurrentRecord.end.hour != noTime)
{
(const Char*)endTime=
CtlGetLabel(GetObjectPtr(ServicePeriodEndSelTrigger));
TimeToAscii(gCurrentRecord.end.hour,
gCurrentRecord.end.minute,sysPrefs.timeFormat, endTime);
endlbl = MemPtrNew(StrLen(endTime)+1);
StrCopy(endlbl, endTime);
CtlSetLabel(GetObjectPtr(ServicePeriodEndSelTrigger),endlbl);
}
// Move start time to screen
(const Char*)startTime =
CtlGetLabel(GetObjectPtr(ServicePeriodStartSelTrigger));
TimeToAscii(gCurrentRecord.start.hour,
gCurrentRecord.start.minute,sysPrefs.timeFormat, startTime);
startlbl = MemPtrNew(StrLen(startTime)+1);
StrCopy(startlbl, startTime);
CtlSetLabel(GetObjectPtr(ServicePeriodStartSelTrigger),startlbl);
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/