Why not just FldDelete and FldInsert the information? You seem to be doing
more work than is necessary.
Elia
-----Original Message-----
From: Michael McFarland [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 09, 1999 12:59 PM
To: 'Palm Development List'
Subject: problem w/ simple field text update
Let's say I have a form w/ several fields and a button. When the
button is pressed, I'd like whichever field currently has the focus to have
it's text set to "howdy". This is what I'm doing... and instead of
"howdy", the selected field winds up with 5 spaces added to it. Could
somebody tell me what I'm doing wrong?
static Boolean MainFormHandleEvent(EventPtr eventP)
{
...
switch (eventP->eType) {
case ctlSelectEvent: // A control button was pressed and released.
switch (eventP->data.ctlEnter.controlID) {
case ProgramMainTestButton: // the single button
on the form
if ((fldP = GetFocusObjectPtr()) != NULL) {
textH = MemHandleNew(10);
if (textH) {
textP = MemHandleLock(textH);
StrPrintF(textP, "Howdy");
MemHandleUnlock(textH);
if (FldGetTextPtr(fldP))
FldDelete(fldP, 0,
FldGetTextLength(fldP));
FldSetTextHandle(fldP, textH);
}
}
break;
}
break;
}
}