Dear NG,
First of all, you should know that the way of dealing with a Label is different
from a Field. If it is a Label, you should use the following function, see the
API Reference for usage.
CtlSetLabel();
Otherwise, it is a Field, you should put text onto the field with following
function:
void AssignFrmFldText(FormPtr frmP, UInt16 fldId, Char *string)
{
FieldPtr fldP;
MemHandle h;
fldP = FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, fldId));
h = FldGetTextHandle(fldP);
if (h == NULL)
h = MemHandleNew(FldGetMaxChars(fldP));
StrCopy((Char *) MemHandleLock(h), string);
MemHandleUnlock(h);
FldSetTextHandle(fldP, h);
}
In fact, if you are not going to change the field content and simply want to
display some text on screen. Why not use a label? It is far more easier.
Regards,
Stephen H.S. Lee
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of N Grant
Sent: Thursday, March 01, 2007 2:49 PM
To: Palm Developer Forum
Subject: Displaying a default time in an editable field
Guys
Can someone have a look at this code snippet & tell me what silly mistake I am
making.
The code displays nothing in the field ConfigurePhoneTimephoneonField on the
form, it generates no errors & the rest of the fields on the form work fine,
but they are not time fields (Dont think this makes any difference). It is Not
a Numeric field.
Any ideas ?
ctlP = ( ControlType * ) FrmGetObjectPtr ( frmP, FrmGetObjectIndex( frmP,
ConfigurePhoneTimephoneonField ) ); labelP = (Char *) CtlGetLabel( ctlP );
timeP->hours = 8;
timeP->minutes = 45;
TimeToAscii( timeP->hours, timeP->minutes, tfColonAMPM , labelP );
/* TimeToAscii
(
timeP->hours,
timeP->minutes,
TimeFormatType ( PrefGetPreference ( prefTimeFormat ) ) ,
labelP
);
*/
CtlSetLabel ( ctlP, labelP );
FrmShowObject ( frmP , FrmGetObjectIndex( frmP, ConfigurePhoneTimephoneonField
) );
TIA
NG
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/