Datagrid error...

Trevor DeVore lists at mangomultimedia.com
Tue Dec 18 11:16:41 EST 2018


On Tue, Dec 18, 2018 at 9:31 AM Paul Dupuis via use-livecode <
use-livecode at lists.runrev.com> wrote:

>
> built under LiveCode 6.7.11. We are readying a new version built under
> LC9.0.1, but without a recipe for the error, I have no way of testing
> whether the new engine (and newer Datagrid) fixes this issue. I was
> hoping the executionCotexts might provide some insight as to a suggested
> recipe to reproduce the error.
>

I just checked the Data Grid script in 6.7.11 by executing the following
code in the Message Box:

 ```
edit script of button id 1005 of stack "revDataGridLibrary"
```

If we piece together what we know from the error we get the following:

1) `_DrawListWithProperties` is called
2) `_table.DrawWithProperties` is called
3) `_table.DrawControlsInRealTime` is called
4) `_table.DrawColumns` is called
5) An object that doesn't exist is referenced and triggers the "can't find
object".

The line that triggers the "can't find object" error is line 3919. Line
3919 is part of the `_table.DrawColumns` private command which draws
columns in a table. It reads as follows:

```
put the dgIndex of theControl into theCurrentIndex
```

This tells us that `theControl` doesn't exist. `theControl` comes from line
3910:

```
put line theControlIndex of theMasterControlList[theColumn] into theControl
```

`theMasterControlList` is a list of existing controls that can be used to
render the data for a particular row and column in the table.

What is interesting here is that `_DrawListWithProperties` is the entry
point. `_DrawListWithProperties` is a private command and the error report
isn't telling us who is calling `_DrawListWithProperties`. That complicates
things a bit since we don't know if it is being called when you set the
`dgData`, when the user is scrolling, when the user clicks on a row, etc.
One potentially important piece of information is that
`_DrawListWithProperties` can be called by `_ScrollListV`, Because
scrolling can happen very quickly `_ScrollListV` will throttle itself
meaning that if it is currently running when it is called (e.g. the user is
scrolling quickly and `_ScrollListV` hasn't finished rendering the last
scroll request) then it will call itself in time so that the new scroll
request can be processed after the current scroll request finishes
rendering. If `_DrawListWithProperties` was called from a scrolling action
then the theory I propose below might be possible.

Given what we know my best guess is that the columns property is being set
and in the process a column is being removed. At the same time,
`_DrawListWithProperties` is being triggered which is trying to draw the
column that was removed. A `_ScrollListV` request sent in time might be
able to create such a scenario.

Now, all of this leads me to the following questions –

1) Are you modifying the columns displayed in this Data Grid through code?
2) If so, is it possible that you are updating the columns in the Data Grid
while the user is interacting with it?

-- 
Trevor DeVore
CTO - ScreenSteps
www.screensteps.com



More information about the use-livecode mailing list