> I think this has got something to do with the MemHandlelock and
unlock.. But
> i have no clue as to how to deal with "Bad chunk header" error. And i
have
> already spent 3 days working on this...
>
>
> static Boolean LoginFormHandleEvent(EventPtr event)
> {
>
> Boolean handled = false, checkPass=false;
> EventType newEvent;
> FormPtr frm;
> int i=0;
> Word fldIndex1, fldIndex2;
> FieldPtr fld1, fld2;
> CharPtr textID;
> CharPtr textPass=NULL;
> CharPtr title;
>
> VoidHand recordH;
> SiteDeptRecordTypePtr recordP;
> Word pindex;
>
> switch (event->eType)
>
> {
> case nilEvent:
> LoginFormUpdateTime ();
> LoginFormUpdateDate ();
> handled= true; // handled
> break;
>
> case ctlSelectEvent:
> switch (event->data.ctlEnter.controlID)
>
> {
> case frmOpenEvent:
>
> FrmDrawForm(FrmGetActiveForm());
> LoginFormForceDrawForm ();
>
> //The following code is to display the site and department
> //at login screen kind stuff
>
> recordH = DmQueryRecord(SiteDB, 0);
> recordP =(SiteDeptRecordTypePtr)MemHandleLock(recordH);
>
> StrCopy(title, recordP->siteLookup);
> StrCat(title, " ");
> StrCat(title, recordP->deptLookup);
>
> FrmSetTitle(frm, title);
This code is going to fail badly.
1) You never allocate space for the variable 'title'. Your StrCopy is
copying into random territory, and you really should have crashed them.
2) Calling FrmSetTitle with a pointer to random space is bad, since Palm
OS will store away the pointer and use it to redraw the title when its
needed.
>
> MemHandleUnlock(recordH);
> /*The code section which comment out displays "Hello (:-" +
PalmPilot's user
> */
>
> if(focus!=0)
> {
> FrmSetFocus(frm, FrmGetObjectIndex(frm,
> DataCollectorLoginPasswordFieldField));
> }
> else
> {
> pindex=FrmGetObjectIndex(frm,
DataCollectorLoginIDFieldField);
> FrmSetFocus(frm, pindex);
> }
> handled=true;
> break;
>
> case frmCloseEvent:
> frm=FrmGetActiveForm();
> focus=0;
> // PreviousView=DataCollectorLoginForm;
> break;
> }
> return(handled);
> }
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/