Lock Screen does NOT work!

Bob Sneidar bobsneidar at iotecdigital.com
Thu Jan 24 14:29:13 EST 2019


For those interested, I've had a bit of a revelation concerning datagrids and the selectionChanged handler. Here's the problem. 

I use datagrids extensively. I have code in my selectionChanged handlers in the datagrids that update the card objects; fields buttons etc. It's convenient for me therefore when I change the hilited line by script to simply send selectionChanged to the appropriate datagrid. This however has uncovered an anomaly (I don't say bug) where an endless recursion can occur in the datagrid library if selectionChanged gets called again while the first is still executing. 

My solution heretofore has been to send in time whenever I do this with a datagrid. Well then the problem is, send in time cancels ALL my screen locks! One idle message and the engine clears all the locks! 

So now I see that I have to move the code which updates the card OUT of the selectionChanged handler into it's own custom handler, and call that handler when I need to do so. I guess this goes back to an old "best practice" coding concept I heard some time ago about always using custom handlers to do the work, instead of the built in handlers. Now I see why that is such good advice. 

I hope my little journey and conclusions will help to prevent anyone else from stumbling on similar problems. 

Bob S


> On Jan 24, 2019, at 11:00 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hmmm... Belay that. I bet I am using send in time somewhere prior to the datagrid updates. That would pop an idle message and cancel the screen lock. 
> 
> Bob S
> 
> 
>> On Jan 24, 2019, at 10:52 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Hi all. Bold subject line I know. Here's how I know. 
>> 
>> I used Find in This Stack and it's SubStacks to find "lock screen". I replaced all with "-- lock screen" effectively commenting out ALL of the lock screen statements. I verified by checking one of the found scripts and indeed lock screen is commented out! With me so far? 
>> 
>> I then go to the ONE SCRIPT that I am testing with and uncomment that ONE LINE with the lock screen statement. I execute the code, the screen does NOT LOCK. I still see several updates, like a datagrid loading new data, then loading a different dataset! I should only see the loading of the second dataset! BOO!!!
>> 
>> I suspected this was the case for some time but never got around to testing this for sure until just now. Something is either unlocking the screen or else is never locking it, and it isn't my code. 
>> 
>> Bob S




More information about the use-livecode mailing list