> From: Johnathan Smith
>
> I am new to palm programming I have a form with 3
> textfields on it and one button. if the user clicks on
> the button I would like to take the value from field1
> and field2 and but the total into field3.  Can someone
> please show me some sample code on how to read data
> from the textfields, do total and then display the
> data.  Thanks
>

To get text from a field (some untested code):

Char text[SIZE];
FormPtr frmP = FrmGetActiveForm();
FieldType * fldP = FrmGetObjectPtr( frmP, FrmGetObjectIndex( frmP,
TheField ) );
StrCopy( text, FldGetTextPtr( fldP ) );

To total two fields, convert them to numbers (e.g., with StrAToI), then add
them together, then convert the result to a string (e.g. with StrPrintF).

To display the data in a non-editable field, use FldSetTextPtr().

This should be more than enough to get you started.  Next, you should read a
book on Palm OS Programming.  See
http://www.palmos.com/dev/tech/docs/other.html .


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to