Thanks Philip,
hText is a local variable. Local to the event handling function of the edit
form. The AddNoteDoneButton is the button indicating to save the data
(cancel works fine, it just exits the form) So I didn't think I would need
to free hText since it should go away once it is out of scope. I tried
MemHandleFreeText(hText) just for grins and that got me a memory chunk ptr
error. (which seems reasonable)
If I leave it as it is I keep getting an error writing directly to screen
memory. I don't know how one does that since I am only using the published
API's. So I suspect some sort of memory stomp perhaps?
Thanks,
Jim
.
"Philip Sheard" <[EMAIL PROTECTED]> wrote in message
news:40108@palm-dev-forum...
>
>
> > I think so.
> > Here is the code (snippet)
> > ===============
> > case AddNoteDoneButton: //Save the data and leave the form
> > frm = FrmGetActiveForm();
> > wIDField=FrmGetObjectIndex(frm,AddNoteNoteField);
> > pCtlField=(FieldPtr) FrmGetObjectPtr(frm,wIDField);
> > FldCompactText(pCtlField);
> > textLen=FldGetTextLength(pCtlField);
> > if (FldGetTextLength(pCtlField)>0) // We can add a note since we have
> > something
> > {
> > hText=FldGetTextHandle(pCtlField);
> > FldSetTextHandle(pCtlField,NULL);
> > pText=(CharPtr)MemHandleLock(hText);
> > addNote(pText,ADD_NOTE_NOTE );//inserts note into database
> > MemHandleUnlock(hText);
>
> depending on the provenance of hText, you might need
> MemHandleFree(hText);
>
> > // FldFreeMemory( pCtlField );
> > }
> > FrmGotoForm(PalmLinkPatientNotesForm);
> > handled=true;
> > break;
> > ==================
> >
> > Originally I did not have the line
> > FldSetTextHandle(pCtlField,NULL);
> > and adding the line:
> > FldFreeMemory( pCtlField );
> > would cause it to crash which is why it is commented out.
> >
> > In this example I only have one text field on the whole form. (so it is
> the
> > simplest case)
> > Thanks,
> > Jim
> >
> > --
> > Our new email address is [EMAIL PROTECTED]
> > .
> > "Philip Sheard" <[EMAIL PROTECTED]> wrote in message
> > news:40070@palm-dev-forum...
> > >
> > >
> > > > I have a form where some editing occurs. When the user presses the
OK
> > > > button the values are collected off the screen and saved in a
> database.
> > > > Then a gotoForm is called and when this form comes up it crases in
the
> > > forms
> > > > open event. In that event I have a variety of functions getting
> called.
> > > If
> > > > I rearrange these functions It will crash in a different place.
> >
> > > >
> > > > I am using global variables. Am I over running my stack? It seems
to
> > me
> > > > that the functions are doing the correct things (because if I put
the
> > > order
> > > > of execution differently the program does not crash in the same
spot).
> > I
> > > am
> > > > a little confused as to how the use of global variables affects my
> stack
> > > > size if any. Does it?
> > >
> > > The error lies in the form being closed. Have you freed all the text
> > > handles?
> > >
> > >
> > >
> >
> >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
> >
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/