Re: DataGrid Crash to Desktop Revisited

2019-12-19 Thread Tom Glod via use-livecode
Np, if you've tried my toolbox, I've been to hell and back with the
datagrid, and made every error imaginable...including this one.  There is
still one that I need to try to replicate ...because the result was bonkers.

On Thu, Dec 19, 2019 at 4:57 PM Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Thanks for the confirmation Tom.
>
> Bob S
>
>
> > On Dec 19, 2019, at 12:17 , Tom Glod via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Hey Bob
> >
> > When you set the data of a grid, the selection IS changed to empty. thats
> > all you need to know. triggering another handler in this is the
> correct
> > way to do it.
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Tom Glod
Founder & Developer
MakeShyft R.D.A (www.makeshyft.com)
Office:226-706-9339
Mobile:226-706-9793
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: DataGrid Crash to Desktop Revisited

2019-12-19 Thread Bob Sneidar via use-livecode
Thanks for the confirmation Tom. 

Bob S


> On Dec 19, 2019, at 12:17 , Tom Glod via use-livecode 
>  wrote:
> 
> Hey Bob
> 
> When you set the data of a grid, the selection IS changed to empty. thats
> all you need to know. triggering another handler in this is the correct
> way to do it.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: DataGrid Crash to Desktop Revisited

2019-12-19 Thread Tom Glod via use-livecode
Hey Bob

When you set the data of a grid, the selection IS changed to empty. thats
all you need to know. triggering another handler in this is the correct
way to do it.



On Thu, Dec 19, 2019 at 10:48 AM Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Yeah tried that. Data doesn't get set.
>
> My problem is that I have been using SelectionChanged to do a lot of
> things, like populate the card objects (I call it a form). I was thinking
> that there might be some way to discern that an existing SelectionChaged
> handler was in effect in the datagrid library, but then what? If I could
> pull that off, it would have to be in the dgdata custom property before it
> calls anything that might call selectionChanged. I suspect it would unravel
> something else though.
>
> What I will do instead is put all the code I need in another handler, and
> then call that handler in time. That is what I have done with all my other
> forms, but I thought I would revisit this in the hopes of a more
> comprehensive solution.
>
> Bob S
>
>
> > On Dec 18, 2019, at 17:28 , Mark Wieder via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> >> I'm not sure why this is, but I think it's because the datagrid library
> does something internernally that triggers another selectionChanged,
> causing an infiinite loop, forcing the engine to bail out.
> >
> > Yes, that's what I would expect. Selecting different data *should* cause
> another selectionChanged event.
> >
> >> Any ideas?
> >
> > on selectionChanged
> >  put the dgHilitedIndex of me into tHilitedIndex
> >  put the dgDataOfIndex [tHilitedIndex] of me into aDGData [1]
> >  lock messages
> >  set the dgData of me to aDGData
> >  unlock messages
> > end selectionChanged
> >
> > --
> > Mark Wieder
> > ahsoftw...@gmail.com
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Tom Glod
Founder & Developer
MakeShyft R.D.A (www.makeshyft.com)
Office:226-706-9339
Mobile:226-706-9793
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: DataGrid Crash to Desktop Revisited

2019-12-19 Thread Bob Sneidar via use-livecode
Yeah tried that. Data doesn't get set. 

My problem is that I have been using SelectionChanged to do a lot of things, 
like populate the card objects (I call it a form). I was thinking that there 
might be some way to discern that an existing SelectionChaged handler was in 
effect in the datagrid library, but then what? If I could pull that off, it 
would have to be in the dgdata custom property before it calls anything that 
might call selectionChanged. I suspect it would unravel something else though. 

What I will do instead is put all the code I need in another handler, and then 
call that handler in time. That is what I have done with all my other forms, 
but I thought I would revisit this in the hopes of a more comprehensive 
solution. 

Bob S


> On Dec 18, 2019, at 17:28 , Mark Wieder via use-livecode 
>  wrote:
> 
>> I'm not sure why this is, but I think it's because the datagrid library does 
>> something internernally that triggers another selectionChanged, causing an 
>> infiinite loop, forcing the engine to bail out.
> 
> Yes, that's what I would expect. Selecting different data *should* cause 
> another selectionChanged event.
> 
>> Any ideas?
> 
> on selectionChanged
>  put the dgHilitedIndex of me into tHilitedIndex
>  put the dgDataOfIndex [tHilitedIndex] of me into aDGData [1]
>  lock messages
>  set the dgData of me to aDGData
>  unlock messages
> end selectionChanged
> 
> -- 
> Mark Wieder
> ahsoftw...@gmail.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: DataGrid Crash to Desktop Revisited

2019-12-18 Thread Mark Wieder via use-livecode

On 12/18/19 4:30 PM, Bob Sneidar via use-livecode wrote:


I'm not sure why this is, but I think it's because the datagrid library does 
something internernally that triggers another selectionChanged, causing an 
infiinite loop, forcing the engine to bail out.


Yes, that's what I would expect. Selecting different data *should* cause 
another selectionChanged event.



Any ideas?


on selectionChanged
  put the dgHilitedIndex of me into tHilitedIndex
  put the dgDataOfIndex [tHilitedIndex] of me into aDGData [1]
  lock messages
  set the dgData of me to aDGData
  unlock messages
end selectionChanged

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: DataGrid Crash to Desktop Revisited

2019-12-18 Thread Bob Sneidar via use-livecode
This is likely the culprit in the datagrid library. There are a number of 
places where it is called:

private command _SelectionChanged pPreviouslyHilitedIndexes
   dispatch "selectionChanged" with sHilitedIndexes, pPreviouslyHilitedIndexes
end _SelectionChanged

I think what is needed is a way to discern that a selectionChanged handler is 
already in progress when setting the dgData. I could trace all the way through 
the datagrid library, but it's late, and I was hoping someone could quick fix 
this for me. I do this a LOT, strange as it seems. 

Bob S


> On Dec 18, 2019, at 16:30 , Bob Sneidar via use-livecode 
>  wrote:
> 
> Hi all. 
> 
> I have isolated the issue I presented some time ago, where selecting a record 
> in a datagrid crashed Livecode to desktop. It can be reproduced easily 
> enough. 
> 
> Create a stack with a single datagrid, add 2 records. In the script of the 
> datagrid have a selectionChanged handler like so:
> 
> on selectionChanged
>  put the dgHilitedIndex of me into tHilitedIndex
>  put the dgDataOfIndex [tHilitedIndex] of me into aDGData [1]
>  set the dgData of me to aDGData
> end selectionChanged
> 
> This demonstrates that a datagrid's selectionChanged handler cannot set it's 
> own dgData! Neither can any other handler in the executionContexts that 
> selectionChanged calls, while that selectionChanged is still in the 
> executionContexts. (That's too confusing.) 
> 
> In other words, while a datagrid's selectionChanged handler is "running" 
> nothing can change the contents of the datagrid. 
> 
> I'm not sure why this is, but I think it's because the datagrid library does 
> something internernally that triggers another selectionChanged, causing an 
> infiinite loop, forcing the engine to bail out. 
> 
> Any ideas?
> 
> Bob S


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


DataGrid Crash to Desktop Revisited

2019-12-18 Thread Bob Sneidar via use-livecode
Hi all. 

I have isolated the issue I presented some time ago, where selecting a record 
in a datagrid crashed Livecode to desktop. It can be reproduced easily enough. 

Create a stack with a single datagrid, add 2 records. In the script of the 
datagrid have a selectionChanged handler like so:

on selectionChanged
  put the dgHilitedIndex of me into tHilitedIndex
  put the dgDataOfIndex [tHilitedIndex] of me into aDGData [1]
  set the dgData of me to aDGData
end selectionChanged

This demonstrates that a datagrid's selectionChanged handler cannot set it's 
own dgData! Neither can any other handler in the executionContexts that 
selectionChanged calls, while that selectionChanged is still in the 
executionContexts. (That's too confusing.) 

In other words, while a datagrid's selectionChanged handler is "running" 
nothing can change the contents of the datagrid. 

I'm not sure why this is, but I think it's because the datagrid library does 
something internernally that triggers another selectionChanged, causing an 
infiinite loop, forcing the engine to bail out. 

Any ideas?

Bob S


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode