I am trying to use the code but I am getting the
following error within the SetFieldTextFromStr
Error : illegal implicit conversion from 'void *' to
'char *'
Starter.cpp line 221 StrCopy( MemHandleLock(txtH),
strP );
Thanks for your help once again. Do you have AIM?? If
so your can find me online my name is redhatpusher
--- Richard Burmeister <[EMAIL PROTECTED]> wrote:
> > From: Johnathan Smith
> >
> > Thanks. but can you please help. I have the
> following
> > code. I know how to get the data now. but I have
> to
> > find a way to total it
> >
> > FormPtr form = FrmGetActiveForm();
> > FieldPtr field;
> > MemHandle h;
> > CharPtr s;
> >
> > field = (FieldPtr)FrmGetObjectPtr(form,
> FrmGetObjectIndex(form,MainField1Field));
> > h = FldGetTextHandle(field);
> > if (h)
> > {
> > s = MemHandleLock(h);
> > FldSetTextHandle(field, NULL);
> > FldDrawField(field);
> > field = (FieldPtr)FrmGetObjectPtr(form,
> FrmGetObjectIndex(form,MainTotalField));
> > FldSetTextHandle(field, h);
> > FldDrawField(field);
> >
>
> Well, this code doesn't do what you say you are
> trying to do.
>
> Here is the only code I'm going to write entirely
> for you. (I already told
> you how to do it.) Next time you have to figure it
> out yourself.
>
> Comments below are from my previous instructions.
>
>
/***********************************************************************
> * add the numbers in 2 fields and store the result
> in a third field
>
>
***********************************************************************/
> static void foo(void)
> {
> // To get text from a field:
> Char text1[SIZE], text2[SIZE], text3[SIZE];
> Int32 val1, val2, val3;
> FormPtr frmP = FrmGetActiveForm();
> FieldType * fld1P = FrmGetObjectPtr( frmP,
> FrmGetObjectIndex( frmP,
> Main1Field ) );
> FieldType * fld2P = FrmGetObjectPtr( frmP,
> FrmGetObjectIndex( frmP,
> Main2Field ) );
> FieldType * fld3P = FrmGetObjectPtr( frmP,
> FrmGetObjectIndex( frmP,
> Main3Field ) );
>
> StrCopy( text1, FldGetTextPtr( fld1P ) );
> StrCopy( text2, FldGetTextPtr( fld2P ) );
>
> // To total two fields, convert them to numbers
> (e.g., with StrAToI),
> val1 = StrAToI( text1 );
> val2 = StrAToI( text2 );
>
> // then add them together,
> val3 = val1 + val2;
>
> // then convert the result to a string (e.g. with
> StrPrintF).
> StrPrintF( text3, "%ld", val3 );
>
> // To display the data in a non-editable field, use
> FldSetTextPtr().
> // *** I prefer use SetFieldTextFromStr since it
> also works on editable
> fields. ***
> SetFieldTextFromStr( Main3Field, text3 );
> }
>
> You can find the source code for
> SetFieldTextFromStr() in the archives. It
> was posted there just 10 days ago.
>
>
> --
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/