Thanks.

I gave it a try.  Still no success.

The following is my attempt to call your function from a menu
(with a few artifacts from a prior attempt to call :
SetFieldTextFromStr(field, pText, redraw)).
This doesn't save anything, it is merely a placeholder for what I eventually
hope to do, which also
requires putting the text to the screen:

case Save:
  {
   FormType * frmP;
   Char* pText = (Char*) MemPtrNew(5);  // allocate 5 bytes

     FieldType * field;
      Boolean redraw;
      struct transformer
   {
   UInt16 TranskVA;
   } My_Transformer;
      redraw=true;
      /* Clear the menu status from the display */
      MenuEraseStatus(0);
      frmP = FrmInitForm (TransformerForm);
      field = GetObjectPtr(FrmGetObjectIndex(frmP, kVA));
   // copy kVA into the char ptr
   StrCopy(pText, "2000");

   //Actions taken due to selection of transformer "save"
      //SetFieldTextFromStr(field, pText, redraw);
      mySetFieldText(frmP, kVA, pText);

   //mySetFieldText(FormType *frmP, UInt16 fieldID, Char *st)



      //Actions that follow if nothing is done by code
      //to save data



   /* Display the Transformer Box. */


   FrmDoDialog (frmP);
   FrmDeleteForm (frmP);

   handled = true;
   break;
  }

My current resource header file looks like:

/* pilrc generated file.  Do not edit!*/
#define TransAbout 1021
#define Save 1020
#define kVA 1019
#define XFMROKButton 1018
#define DataEntryMenu 1017
#define TransformerForm 1016
#define AboutVersionField 1015
#define AboutOKButton 1012
#define AboutForm 1011
#define MainClearTextButton 1010
#define MainDescriptionField 1009
#define MainForm 1008
#define RomIncompatibleAlert 1007
#define EditOnlyMenuBar 1005
#define OptionsAboutPSEDAT 1004
#define PD1_XFMR 1003
#define MainMenuBar 1001

(just for anyone doubting the field name)
----- Original Message ----- 
From: "Robert Moynihan" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Sent: Thursday, October 13, 2005 7:59 PM
Subject: Re: Form Loading Problem


> Del Ventruella wrote:
>
> >I have the "about" form loading now.
> >
> >I still need to know how to get a text string (char*) to load and display
in
> >a field on a form.
> >
> >
> This is what I use..  Bob
>
> void mySetFieldText(FormType *frmP, UInt16 fieldID, Char *st)
> {
>     FieldType    *fldP;
>     MemHandle    textH;
>     Char        *textP;
>     UInt8        fldLen=0;
>
>     fldP = FrmGetObjectPtr (frmP, FrmGetObjectIndex (frmP, fieldID));
>     FldFreeMemory(fldP);
>     FldSetTextHandle (fldP , NULL);
>     fldLen=FldGetMaxChars(fldP);
>     textH=MemHandleNew(fldLen+1);
>     if (textH){
>         textP=MemHandleLock(textH);
>         StrNCopy(textP,st,fldLen);
>         textP[fldLen]=0;
>         MemHandleUnlock(textH);
>         FldSetTextHandle (fldP , textH);
>     }
>     //optional draw if the form is the current active form
>     if (frmP==FrmGetActiveForm())
>         FldDrawField(fldP);
> }
>
>
> -- 
> For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/
>

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

Reply via email to