Bill,
I see that this post is almost a week old so perhaps you have solved this 
already.

If I'm following what you are saying correctly you are losing your form 
pointer and your table pointer?

The reason for this is that you are changing the data associated with the 
table/form.  The functions FrmGetActiveForm, FrmGetObjectPtr, and the like 
do not lock the memory pointed to by the pointer returned, and as you have 
seen you will run into problems if you continue to access these pointers 
after certain calls.  For safety sake I recommend getting a new pointer 
every time you attempt to access the form or form object, there is some 
overhead but you will know that you have a good pointer.  I chased my tail 
with a similar problem a few months ago.

Richard

At 07:49 AM 4/3/2002 -0800, you wrote:
>Hi, this is probably a basic question, but I haven't figured it out, here is
>the code:
>
>Tasks* TaskData[500];
>
>  // Get data from tasks database
>  OpenTasksDB();
>
>  UInt16 TotalRecords=GetSizeTasksDB();
>  for (int index=0; index<TotalRecords; index++)
>  {
>   TaskData[index] = new Tasks;
>   TaskData[index]->Description=GetRecord(index);
>  }
>  CloseTasksDB();
>
>  FormType* pForm = FrmInitForm (ID_TASKSFORM);
>  TableType* table = (TableType*)FrmGetObjectPtr(pForm,
>FrmGetObjectIndex(pForm, ID_TaksTbl));
>  int numRows=TblGetNumberOfRows(table);
>
>  UInt16 numTotalColumns = TblGetNumberOfColumns(table);
>  for (int i=0; i<numTotalColumns; i++)
>  {
>   TblSetColumnUsable (table, i, true);
>   switch (i)
>   {
>    case 0:
>     TblSetColumnWidth (table, i, 15);
>     break;
>
>    case 1:
>     TblSetColumnWidth (table, i, 200);
>     break;
>   }
>   TblSetColumnSpacing (table, i, 1);
>  }
>
>//>>>The pointer turns NULL  at this point.....
>
>  for (int i=0; i<numRows; i++)
>  {
>   TblSetItemStyle (table, i, 0, checkboxTableItem);
>   TblSetItemStyle (table, i, 1, labelTableItem);
>   TblSetColumnUsable(table, 0, true);
>  }
>
>  for (int i=0; i<TotalRecords; i++)
>   TblSetItemPtr (table, i, 1, TaskData[i]->Description);
>
>  FrmDoDialog (pForm);
>........
>
>The pForm pointer turns NULL at the point that I have indicated, what am I
>missing??
>I have had this happen before and I thought I had it down, but apparently
>not.
>I have a little concept of handles, I even tried to use one here but it was
>a mess and I think I did it wrong.
>any help would be appreciated.
>thanx
>bill
>
>
>--
>For information on using the Palm Developer Forums, or to unsubscribe, 
>please see http://www.palmos.com/dev/support/forums/



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

Reply via email to