gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
274 stars 61 forks source link

Several issues with WIDGET_TABLE #1718

Closed jtappin closed 7 months ago

jtappin commented 8 months ago

In resurrecting some code, and trying to make it work on GDL as well as IDL, I've come across a few issues with the table widget (I should also add that my impression is that IDL doesn't actually do what the documentation says either in some cases).

Here is the basic test code that I've been using to characterize the issues: test_table.pro

The ones that I have reasonably fully characterized so far:

1) When an array is used as the initial value, the table is transposed (IDL on the left, GDL on the right): Screenshot_20240109_093602

2) Setting /editable without /all_events, no events at all are returned; a WIDGET_TABLE_CH should be returned on enter or shifting focus out of a changed cell.

3) For a table with only a single row, attempting to read the value gives an undefined variable error for a table defined as an array, while a table defines by a structure gives:

% TT_EVENT: End of file encountered. Internal error: Stream not found.

along with a pop-up message repeated for each cell.

/usr/src/debug/wxwidgets/wxWidgets-3.2.4/src/generic/grid.cpp(1827): assert ""(row >= 0 && row < GetNumberRows()) && (col >= 0 && col < GetNumberCols())"" failed in GetValue(): invalid row or column index in wxGridStringTable

I think this is at least partially related to the first issue, as running the test program with row=4, fill=4 gives similar errors if anything is changed, and in the array-values case only a 3x3 block is returned if the value is read before any changes.

4) So far as I can see, the only event actually returned when /all_events is set is the WIDGET_TABLE_CELL_SEL event

Running latest GIT: b82c7376 (also seen on https://github.com/gnudatalanguage/gdl/commit/44a497bced2627ccf20d003cdc9b49c2ece91f27) on Manjaro Linux

There are also some funnies with empty cells that I've not yet chased into a corner (that's where I'm not sure IDL does it right either).

GillesDuvert commented 8 months ago

@jtappin widget_table is essentially untested so I'm not surprised (even if I could have spotted the transposition effect). I've already cured this, and will continue as I see other issues. Thanks for always providing small test procedures they help a lot.

GillesDuvert commented 7 months ago

1735 should solve several problems, but is far from complete.