> -----Original Message-----
> From: Dev Nair [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 09, 2001 9:33 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE: Need some help on Palm OS Tables
> 
> 
> 
> Hi Richard,
> 
>  Thanx a lot for ur reply. I'll try out what u suggested. But 
> the column in which I'm displaying my database field data is 
> itself of type LABEL, and not numeric/custom. I haven't tried 
> out the custom/text type table columns bcos, to begin with 
> the tables programming, I just am trying to get some data 
> from my database to show it in the tables. Now I get the 
> other 3 columns static data, but only this column which shows 
> database data shows me the last ie. 3rd record's appropriate 
> field(which comes as required) in all the rows. 

I actually started out assuming that your last column
was text until I re-read your msg & saw that your data
was numbers.  I assumed then that you were using the
numeric cell type.  Like I said, actual code makes 
checking out what's wrong much easier ;-)

> 
> So, itz just label type, b4 I get into the custom/text type 
> table columns which require me to write those extra 
> load/save/draw routines. 
> 

The thing is, that those routines actually make the job
easier, not harder.  With lists, there are two ways you
can do it -- custom draw or operating system draw -- and
the custom draw method is easier.  Likewise I expect that
the easiest way to deal w/ tables (at least display-only
tables) is the custom draw method.  That would be easier
that the custom load method, and even easier than trying
to stuff things in each cell yourself (which is what I think
you are trying to do now).

Anyway, since you said that you are using label, not numeric,
what I expect is that you have a loop and a string (Char array)
that you are filling with the integer value w/ an itoa routine,
then using TblSetItemPtr() to put that string into the cell.
The thing is that it is the _pointer_ to the string that is
going into the cell.  When you change the contents of that 
string for the next value, then the table cell you have already
filled in will show the _new_ value, because the pointer is
still the same.  

You would have to create a new string for each label that you
want to display.  In your loop you could use "char *p = MemPtrNew(10);"
to get a 10-space string for each cell.


Taking a guess at the code I expect that what you have now is
something like this:

        Char buf[10];
        Int16 i;

        // for each row
                {
                // get data from database, place numeric value in integer i
                StrItoA(buf, i);
                TblSetItemPtr(tblP, row, col, buf);     
                }

where what you need would be more like this:

        // for each row
                {
                Char *p = MemPtrNew(10);
                // get data from database, place numeric value in integer i
                StrItoA(buf, i);
                TblSetItemPtr(tblP, row, col, p);
                }


The down side of this is that since you allocated all of the 
char buffers yourself with MemPtrNew(), you will also have to
dispose of them when you leave the form or you will have a
memory leak.  You may _think_ that you are making things easier by 
avoiding the data loading routines, but you have just taken on the 
memory management chores that the operating system could be doing 
for you!







> 
>  And moreover, I am able to display all the database field 
> records on a different form showing 3 labels and 3 FIELDS, 
> and having previous and next buttons to browse through all 
> the 3 records. On that form, the data is seen perfectly, only 
> in the table, label column containing database field shows 
> last records value in all the rows. Strangely !!!

I am not sure what you mean by "3 FIELDS".  The only table
cell types available are: checkboxTableItem, customTableItem, dateTableItem,
labelTableItem, numericTableItem, popTriggerTableItem, textTableItem,
textWithNoteTableItem, timeTableItem, and narrowTextTableItem.  
There is no fieldTableItem.

> 
> Anyway, thanx a lot again. Do reply if u have any idea where 
> I cud go wrong with this. And my record structure, retrieval 
> of records/fields are fine, I guess bcos they work perfectly 
> while displaying them in FIELDS rather than in Table.
> 

It's almost certainly not the retrieval of the data,
but how you are trying to display that data with the
table. 

-- 
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi./sec ... not just a good idea, it's the LAW!

-- 
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