Datagrid selectionChanged bug?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Datagrid selectionChanged bug?

Tore Nilsen via use-livecode
Hi all.

What I once thought was an endless loop bug I have isolated now to something else. It seems that when selectionChanged for a datagrid is in the executionContexts, the dgData must not be changed. I am not sure if this causes an endless loop internally to the datagrid library or not. All I know is that I immediately CTD if I do it.

What I want to know is if this is "unexpected behavior" or if I am just doing something stupid. I won't go too deep into the weeds on why this is an issue with me, but to give you an idea, I have a search mechanism that will populate a datagrid (say a device or devices that match my search criteria) when text is entered into a field. When the user clicks on the device, I must go back to the customer and sites and yes, the devices and reload the data for all of them.

Everything works as it should up until I attempt to set the dgData for the device datagrid to ALL the devices for that site. Since the selectionChanged handler in the devices datagrid started the whole cascading effect, that handler is still running when the data gets swapped out.

I suppose I can get around it by using send in time so the actual selectionChanged handler finishes before the cascade of form updates happens. But if it is a bug and shouldn't be happening, I suppose I should try to make a stack that reproduces it. (I may have already done so but I don't keep track of my own bug reports!)

Bob S


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid selectionChanged bug?

Tore Nilsen via use-livecode
On Tue, Jun 5, 2018 at 5:27 PM, Bob Sneidar via use-livecode <
[hidden email]> wrote:

>
> I suppose I can get around it by using send in time so the actual
> selectionChanged handler finishes before the cascade of form updates
> happens. But if it is a bug and shouldn't be happening, I suppose I should
> try to make a stack that reproduces it. (I may have already done so but I
> don't keep track of my own bug reports!)
>

The issue you are seeing is probably caused by the inability of the engine
to delete the object that is the target of the current event. When you
replace the data grid contents during selectionChanged you are trying to
delete the control that was clicked on and trigger the selectionChanged
message. The engine doesn’t like that. You will need to use `send in time`
to accomplish what you are after.

--
Trevor DeVore
ScreenSteps
www.screensteps.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid selectionChanged bug?

Tore Nilsen via use-livecode
Trevor you are brilliant. Now that you put it that way, that is *exactly* what is happening. The datagrid works so seamlessly it's easy to forget it's not data I am working with but groups of objects that must be deleted and recreated as needed.

Bob S


> On Jun 5, 2018, at 21:50 , Trevor DeVore via use-livecode <[hidden email]> wrote:
>
> On Tue, Jun 5, 2018 at 5:27 PM, Bob Sneidar via use-livecode <
> [hidden email]> wrote:
>
>>
>> I suppose I can get around it by using send in time so the actual
>> selectionChanged handler finishes before the cascade of form updates
>> happens. But if it is a bug and shouldn't be happening, I suppose I should
>> try to make a stack that reproduces it. (I may have already done so but I
>> don't keep track of my own bug reports!)
>>
>
> The issue you are seeing is probably caused by the inability of the engine
> to delete the object that is the target of the current event. When you
> replace the data grid contents during selectionChanged you are trying to
> delete the control that was clicked on and trigger the selectionChanged
> message. The engine doesn’t like that. You will need to use `send in time`
> to accomplish what you are after.
>
> --
> Trevor DeVore
> ScreenSteps
> www.screensteps.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode