Hi,

I'm getting some confusing behavior with TblSelectItem. My table has 12
rows, and is being use to display 20 records from a database. So when first
displayed, the table shows the data from rows 0 through 11 of the database.

I want users to be able to use the up and down arrows on a keyboard to
select a row. Each time the down arrow is pressed, I use
TblGetSelection(table, &sel_row, &sel_col) to get the current selection. If
there is none, I simply select the top row with:

        TblSelectItem(table, 0, 0);

If there is already a selection, and it is in table row 0 through 10, I
simply do:

        sel_row++;
        TblSelectItem(table, sel_row, 0);

to select the next row, and that works fine.

The problem I have occurs when the last row in the table, row 11, is the one
that is currently selected. When that happens, and the users presses the
down arrow, the table needs to be scrolled down one line, so that table rows
0 through 11 now display database rows 1 through 12. So I call my code to
scroll down 1 row and redraw the table, and that works correctly. I can see
the correct value from database row 12 displayed. Since the selection row
was row 11, and I want that row to STAY selected, I first thought I didn't
have to do anything. But, after the table scrolls down, row 11 becomes
unhilighted. So I thought maybe afer redrawing the table, you must reset the
selection. So at this point I tried:

        TblSelectItem(table, sel_row, 0);

(sel_row is still 11 at this point), but nothing happened. That is, the cell
did not get highlighted.

Strangest of all, if I instead hard code a value like this:

        TblSelectItem(table, 8, 0);

*BOTH* the 8-th and 11-th rows appear highighted. I wouldn't have believed
it if I hadn't seen it with my own two eyes.

To summarize, after I redraw my table (which is all customTableItem), if I:

1. Do nothing, no row is highlighted
2. Do TblSelectItem(table, sel_row, 0) where sel_row is 11, no row is
highlighted
3. Do TblSelectItem(table, 8, 0) BOTH rows 8 and 11 are highlighted

In cases 1 and 2, if I do another TblGetSelection, the OS tells me that the
current selection is row 11 cell 0, but that cell is not highlighted on the
screen. How can it be that the OS has the currently selected row and column
but they are not highlighted/selected/inverted on the screen?

Any ideas? Thanks!

Tom


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