Doesn't he have to change the return types and parameter types in these
functions also?
I don't know what to, because I don't use floats much myself.
But at the moment they're both Int32, you can't pass a float in an Int32
can you? 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dmitry
Grinberg
Sent: 19 December 2006 19:02
To: Palm Developer Forum
Subject: Re: How do I get the value of a numeic form field


Flp* functions deal with floating point numbers, previous code was for
integers, if you swap it for Flp values as i said it will deal with
floats


On 12/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: 

        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/
        




-- 
Best Regards, Dmitry Grinberg
Software Engineer, http://PalmPowerups.com
(847) 226 9295
AIM: DmitryGrinberg
MSN: [EMAIL PROTECTED]
ICQ: 165589894
Y! IM: dmitrygr2003 -- For information on using the PalmSource Developer
Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/ 
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to