This is my first attemp to a "solo flight" at palm programming.  I started
by writing a simple app that takes in a text in a text field and sets that
text as the value of a label.

This is what I got (some code has been snipped):

static Boolean MainFormHandleEvent(EventPtr eventP)
{
    Boolean handled = false;
 EventType newEvent;
    FormPtr frmP;
    CharPtr x;

 switch (eventP->eType)
  {

  case frmOpenEvent:
    (snip)

     case ctlSelectEvent:
   frmP = FrmGetActiveForm();
      if (eventP->data.ctlEnter.controlID == MainOkButton)
     (snip)

   else if (eventP->data.ctlEnter.controlID == MainExecButton)
     {
      if (FrmValidatePtr(frmP)) {
   /* the four lines below are the cause of the problems */

          x  = MemPtrNew(100);
       x = FldGetTextPtr(FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP,
MainTextField)));
       CtlSetLabel(FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP,
MainRespLabel)), x);
       MemPtrFree(x);
         }
     handled = true;
     }
   break;

  default:
   break;

  }
 return handled;
}

Whenever I click the MainExecButton, after entering some text in
MainTextField, I get a Fatal Exception which forces me to reset the devices.
What am I doing wrong?

TIA.

Alex

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Alex Simonetti Abreu  -  Belo Horizonte  -  MG  -  Brazil
http://www.bhnet.com.br/~simonet
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"If a train station is a place where a train stops, what is a workstation?"





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

Reply via email to