Thanks for the suggested work around.
In case it helps work out if it's my code that's causing the problem,
I've copied my code that interacts with the Grid below.
The array I'm giving viewTable is the output of a SQLite query, so the
top row is the column names from the database and the rest is rows of
data.
Are there other globals that I should be updating?
f_flip_button=: 3 : 0
if. (i.0 0) -: CELLDATA__grid do. return. end.
flip__grid ''
)
viewTable=: 3 : 0
CELLDATA__grid=: }.y
HDRCOL__grid=: 3}.each {.y
HDRROW__grid=: 1
show__grid''
)
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris Burke
Sent: Tuesday, 27 February 2007 11:44
To: Programming forum
Subject: Re: [Jprogramming] bug in Grid?
Sherlock, Ric wrote:
> I have a form with a grid that displays different tables depending on
> the selection in a list box.
> The form also has "Flip" button that runs the flip__grid method.
>
> If I change the selected list box item so that the grid displays a
> table that has a different row count to the first then the HdrRowWid
> is not updated and still has the length from the previous table.
>
It is not clear whether this is a bug in the grid code or your app.
A grid has a large number of state globals. Any time you change the size
or type of data being viewed, you need to ensure these globals are all
recalculated properly. The show verb should do this.
However, for your app, the simplest way of selecting different tables to
view is to erase the old grid, and start a new grid with each table.
Alternatively, if you need to keep track of state for each table, then
create a new grid for each table, keeping track of which grid matches
which table. Then reassign the app global that points to the grid on
change of table.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm