frang75 / nappgui_src

SDK for building cross-platform desktop apps in ANSI-C
https://www.nappgui.com
MIT License
503 stars 50 forks source link

Possible bug in tableview_select(...) #130

Open SamSandq opened 7 months ago

SamSandq commented 7 months ago

According to the documentation, a call to tableview_select(....) should scroll the view so that the selected row is visible.

In my case, this row is consistently a few rows below the bottom of the table (if it is tall enough to fall below the view bottom), and thus not visible.

I have to use view_scroll_y((View *) myTableview, pos); with the appropriate values to cause it to be visible.

frang75 commented 7 months ago

Hi! tableview_select() doesn't scroll. tableview_focus_row() does. https://nappgui.com/en/gui/tableview.html#f28

SamSandq commented 7 months ago

Unfortunately, neither tableview_select() nor tableview_focus_row() scrolls my table to the correct row. I use

 uint32_t h = tableview_get_row_height(app->collectionView);
    view_scroll_y((View *) app->collectionView, found*h);

with my own tableview_get_row_height(...).

That actually points to another small issue: I think you should always include a xxx_get_yyy(...)whenever you have a xxx_set_yyy(...).

This would be immensely useful when you want to make a temporary change, and revert back. Currently that is mostly not possible.