I'll try it, never hurts. Now I'll let you know when it works,
Thanks already
>>> [EMAIL PROTECTED] 04/17/00 03:25PM >>>
If you believe it's the FldInsert function, perhaps you should try to
use
FieldPtr SetFieldTextFromStr(Word fldID, CharPtr str) functions posted
on
this newsgroup in the past. I don't know if this helps your and your
cause,
but it's worth a shot.
/***********************************************************************
*
* FUNCTION: SetFieldTextFromHandle()
*
* DESCRIPTION: Sets Field Text by using a Handle
*
* PARAMETERS: - fldID
* - txtH
*
* RETURNED: field pointer
*
***********************************************************************/
FieldPtr SetFieldTextFromHandle(Word fldID, Handle txtH)
{
Handle oldTxtH;
FormPtr frm;
FieldPtr fld;
// Get the Active Form
frm = FrmGetActiveForm();
// Get the Pointer to the Field
fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, fldID));
// Error?!
ErrNonFatalDisplayIf(!fld, "Incorrect Field Specified");
// Swap handles!
oldTxtH = FldGetTextHandle(fld);
FldSetTextHandle(fld, txtH);
// Clear field display
FldEraseField(fld);
// Draw field display
FldDrawField(fld);
// Free some memory baby!
if(oldTxtH)
MemHandleFree(oldTxtH);
// Return the field
return fld;
}
/***********************************************************************
*
* FUNCTION: SetFieldTextFromStr()
*
* DESCRIPTION: Sets Field text from a String
*
* PARAMETERS: - fldID
* - str
*
* RETURNED: field pointer
*
***********************************************************************/
FieldPtr SetFieldTextFromStr(Word fldID, CharPtr str)
{
Handle txtH;
// Create a handle to the string
txtH = MemHandleNew(StrLen(str) +1);
// If the handle is false...
if(!txtH)
return NULL;
// Use the newly created handle to copy the string info to it
StrCopy(MemHandleLock(txtH), str);
// Unlock it
MemHandleUnlock(txtH);
// Use this handle to set the Text to the Field
return SetFieldTextFromHandle(fldID, txtH);
}
The fact the variable "loses" it's information however, makes me
believe it
doesn't have anything to do with the FldInsert function, so much as
it's
being reset.
--
Tim Astle
Patrick Heynen <[EMAIL PROTECTED]> wrote in message
news:8503@palm-dev-forum...
>
> No, when the form is loaded everything is allright. It works just
fine.
> But as soon as the FldInsert Function is passed. There is nothing in
the
> Field and the variable is empty. But when I manually fill the
variable
> at the place where it was read, everything goes well.
> I could make functions that check for the value and then make a
> checking loop and assign the variable on an other way. But It should
> work,
>
> Patrick
>
> >>> [EMAIL PROTECTED] 04/17/00 01:27PM >>>
> Could you be resetting the global variable when the form loads?
>
> --
>
> Tim Astle
>
>
>
> Patrick Heynen <[EMAIL PROTECTED]> wrote in message
> news:8483@palm-dev-forum...
>
> Hi all,
>
> I have a program that copies a decimal value between 50 and 150 From
> an
> field to an other field. I get the user input. Save the data in a
> CharPtr.
> In the debugger is see the value coming in the memory. So far so
good.
> Then
> I switch to an other Form and Want to put the Value in that Screen.
I
> would
> think that would be easy. I use FldInsert. But When the Functions
> starts the
> Pointer to the Char is gone. It Points \0 and the Char is empty. I
> have
> tried all kinds of things. How is this possible.
> Is it possible to exchange data between fields, It should be, or
not.
>
> It is just driving me crazy, I tried all kind of things. I just
don't
> know
> how to handle this. When I assign my own value to the CharPtr, like
> this
> CharPtr Pulse = "60"; everything goes allright and the figure is
> printed in
> the Field. Has It something to do with the FieldPtr that doesn't
exist
> anymore when you are in another Field.
>
> HELP ME,
>
> Thanks already, Patrick Heynen
>
>
>
>
>
>
> --
> For information on using the Palm Developer Forums, or to
unsubscribe,
> please see http://www.palm.com/devzone/mailinglists.html
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html