> I have followed an example to create a table. It compiles successfully but
> error come out when running the application.
> The following are the snippet code in TableInit:
>
> static void MainFormInit(FormPtr form)
> {
>      TablePtr  table;
>      Int16     numRows;
>      Int16     i;
>      DateType  dates[11], today;
>      UInt32    now;
>      UInt32    curDate;
>      ListPtr   list;
>
>      * ((Int16 *) &dates[0]) = noTime;
>      DateSecondsToDate(TimGetSeconds(), &today);
>      now = DateToDays(today);
>      for (i = 1; i < sizeof(dates) / sizeof(*dates); i++) {
>           curDate = now - 5 + i;
>           DateDaysToDate(curDate, &(dates[i]));
>      }
>
>      table = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainTable));
>      list = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainList));
>
>      numRows = TblGetNumberOfRows(table);
>      for (i = 0; i < numRows; i++) {
>           TblSetItemStyle(table, i, 0, labelTableItem);
>           TblSetItemPtr(table, i, 0, gLabels[i]);
>
>           TblSetItemStyle(table, i, 1, dateTableItem);
>           TblSetItemInt(table, i, 1, DateToInt(dates[i]));
>
>           TblSetItemStyle(table, i, 2, numericTableItem);
>           TblSetItemInt(table, i, 2, i);
>
>           TblSetItemStyle(table, i, 3, textTableItem);
>
>           TblSetRowStaticHeight(table, i, true);
>      }
>
>      for (i = 0; i < numTableColumns; i++) {
>           TblSetColumnUsable(table, i, true);
>           switch (i) {
>                case 2:
>                     TblSetColumnSpacing(table, i, 2);
>                     break;
>
>                default:
>                     TblSetColumnSpacing(table, i, 0);
>                     break;
>           }
>      }
>
>      TblSetLoadDataProcedure(table, 3, LoadTextTableItem);
>
>      TblSetSaveDataProcedure(table, 3, SaveTextTableItem);
>
>      FrmCustomAlert(InfoAlertAlert, "1", NULL,NULL);
>      FrmDrawForm(form);                       //Error  come out
>      FrmCustomAlert(InfoAlertAlert, "2", NULL,NULL);
> }
>
> So the error come out when drawing the form:" The application just read
> from memory location 0x00000010 which is in low memory. "
> Does anybody have the idea?

sure.. when you have 0x000000xx type memory locatrions, you can
automatically
assume there is a null pointer somewhere. at somepoint, it is doing
something
like:

ptr->attribute

where attribute = at index 10 :) and, its barfing. :P look for a bad
pointer.

--
Aaron Ardiri
CEO - CTO
Mobile Wizardry
http://www.mobilewizardry.com/


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

Reply via email to