druid wrote:

I am still trying to get this to completly work so I can
figure out how to preload a field on a popup form from
the main form.
Based on the code posted in a different message, here is my project.
I have indicated where the program chokes

Error says it is off screen, then crash's on memory error
In looking where you indicated the error happens (//THESE GUYS), one thing that I should have warned about was that you are trying to dynamically change the text of a label. There is one significant gotcha; you must not try to copy a string that is larger than the original declaration of the label. This is because the original declaration is used to set aside some memory space for the label text. If you try to copy a larger string into that position then you will overflow the allocated memory.
In your code you declared:

LABEL " " LabelID_Input1 AT (5 20) FONT 1

allowing only 1 byte plus the trailing NULL.  Then you try to do this:

FrmCopyLabel(formNew,LabelID_Input1, labelStr1);

where labelStr1="lbl1"

...so you've tried to write a 4char string onto a 1char memory location.

Try adding extra padding into the label declarations.  Like this:
LABEL "                    " LabelID_Input1 AT (5 20) FONT 1

Another way to do it is to use a non-editable field instead of the label. It takes a little more coding, but it doesn't have that gotcha.

Bob



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

Reply via email to