yet another datagrid problem

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

yet another datagrid problem

Post by kevin11 » Mon Sep 05, 2011 7:43 pm

Hi,

I have some code that builds an array X and throws it at a datagrid.
It works perfectly.

I press button A, which populates X with different data.
When I throw it at the datagrid, absolutely nothing happens.

I press button B. It populates X with different data and throws it at the datagrid, which works perfectly.

Now this is what gets me - I press button A and now it works.

I'm used to getting the array messed up and getting a garbled datagrid, but in this case the array seems perfect, but what gets me is that the command "set the dgData of group gridname to griddata" doesn't return, nothing after it is executed. The behaviour script isn't invoked. Message watcher shows the datagrid doing nothing. If during this dark despairing nothingness I press the LC button "Errors" and suppress them, the app hangs. When I try and get out of LC, it hangs that also, so I have to kill the LC process.

This is just weird.

Kevin

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: yet another datagrid problem

Post by dunbarx » Mon Sep 05, 2011 9:06 pm

Quick glance, but is it possible that the quotes you are using include a variable?

In other words, you have:

"set the dgData of group gridname to griddata"

But does this work:

"set the dgData of group gridname to" && griddata

or would:

do ""set the dgData of group gridname to" && griddata

Craig Newman

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: yet another datagrid problem

Post by kevin11 » Mon Sep 05, 2011 9:58 pm

Hi Craig,

Thanks for the reply. There are no quotes in the original. The same instruction is issued each time with different contents in the array. I could understand it if it failed with one set of contents and worked with others, because then there would obviously be something wrong with the array contents. But it works later with identical contents.

The behaviour I get is the same as if I did not issue the instruction at all. The datagrid doesn't change, the cpu stays at zero, message watcher shows no activity, there are no errors. Makes it a bit hard to track down the cause.....

But why does using the errors button on the menu cause the app to hang ? That implies something somewhere is trying to do something and got thwarted ?

Kevin

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: yet another datagrid problem

Post by kevin11 » Tue Sep 06, 2011 9:05 am

Fixed it !

The only difference between the working calls to the datagrid, and the failing call, was the location from where the calls were made. The working ones were called from the card, the failing call was called from the script behaviour for the datagrid where I was handling a mouseup, rebuilding the data array, and sending it off to the datagrid.

There's a tiny very subtle hint on the LC website where it says :

"Don't call a handler that redraws the data grid from within a control in the data grid"

However, the LC team didn't call me to warn me, nor did they come round and visit me in advance. So it's all their fault, and I want compensation, for whiplash or something.

Right, glad we got that sorted.

You may all carry on now with your programming.....

Post Reply