Hi Luca,
The easiest and most logical solution is to keep a (global) reference to the
handles that you pass off to the fields. When setting a field to edit a
handle, the field takes no responsibility for freeing the memory. (It will,
however, resize the handle as needed.) So, when your form is closed, you can
iterate over all the handles and free them.
Take a look at the TextTable sample on our web site, which illustrates
exactly how to do this (and how to make the table scroll).
Go to
http://www.falch.net/KB
and search for TextTable.
Steffen
Falch.net DeveloperStudio for Palm OS
-"Developers' first choice for PDAs"
<http://www.falch.net/>
----- Original Message -----
From: "Luca" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: <[EMAIL PROTECTED]>
Sent: Monday, June 25, 2001 7:46 PM
Subject: table problems (and posting)
>
> Hello people.
>
> First of all, I apologize if this message got posted more than once. I've
> been having problems posting to the forum today. The, as for my
problem...
>
>
> I'm working on an application that uses a table in one of its forms.
This
> table has a coloumn that uses fields to gather and display data. The
field
> load data callback function is passed a pointer to the FieldType in the
> cell
> which allows me to allocate a buffer and place text in there when the
table
> is being loaded. However, my problem arises when I have to free the
chunks
> allocated to the fields: how do I get a pointer to the field in the
table's
> cell? If the field is edited I could free it in my TblSaveDataFuncType,
> but what about the other fields?
>
> The cell is initialized with TblSetItemStyle(tablePtr, row, col,
> textTableItem). I figured that TableItemType's ptr field would contain a
> pointer to a field (FieldType*) so I tried using TblGetItemPtr, casting
to
> FieldType* and using that, but the pointer doesn't refer to a FieldType
> structure and calls to Fld* functions crash.
>
> Any help would be appreciated. Thanks in advance.
> Luca
>
>
>
"Luca" <[EMAIL PROTECTED]> wrote in message news:54218@palm-dev-forum...
>
> Hello people.
>
> First of all, I apologize if this message got posted more than once. I've
> been having problems posting to the forum today. The, as for my
problem...
>
>
> I'm working on an application that uses a table in one of its forms.
This
> table has a coloumn that uses fields to gather and display data. The
field
> load data callback function is passed a pointer to the FieldType in the
> cell
> which allows me to allocate a buffer and place text in there when the
table
> is being loaded. However, my problem arises when I have to free the
chunks
> allocated to the fields: how do I get a pointer to the field in the
table's
> cell? If the field is edited I could free it in my TblSaveDataFuncType,
> but what about the other fields?
>
> The cell is initialized with TblSetItemStyle(tablePtr, row, col,
> textTableItem). I figured that TableItemType's ptr field would contain a
> pointer to a field (FieldType*) so I tried using TblGetItemPtr, casting
to
> FieldType* and using that, but the pointer doesn't refer to a FieldType
> structure and calls to Fld* functions crash.
>
> Any help would be appreciated. Thanks in advance.
> Luca
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/