thanks again... I am a newbie to palm coding... I don't see where I am getting
the decimal value from the code you offered... doesn't this still just get the
integer value from the form field? I need to get the decimal value, the float
or double value. Even if I swap the things you referenced, isn't this still
just getting the integer value from the fields they entered decimal values in?
Int32 getFieldInteger(FormPtr fp,UInt16 fieldId){
return
StrAToI(FldGetTextPtr(FrmGetObjectPtr(fp,FrmGetObjectIndex(fp,fieldId))));
}
void setFieldInteger(FormPtr fp,UInt16 fieldId,Int32 value){
MemHandle mh;
FieldPtr fi;
fi=FrmGetObjectPtr(fp,FrmGetObjectIndex(fp,fieldId));
mh=FldGetTextHandle(fi);
FldSetTextHandle(fi,NULL);
if(mh){
MemHandleResize(mh,16); //no int is bigger then 12 chars long so this
is fine
}
else{
mh=MemHandleNew(16); //no need to check for errors here, if this
fails, you've got bigger problems...
}
StrIToA(MemHandleLock(mh),value);
MemHandleUnlock(mh);
FldSetTextHandle(fi,mh);
FldDrawField(fi);
}
//if you have fields 1000 and 1001 and you want to add them, place result to
field 1002, you'd do something like this:
void doIt(FormPtr myForm){
setFieldInteger(myForm,1002,getFieldInteger(myForm,1000)+getFieldInteger(1001));
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/