Set and get dgData and dgText delay

Richard Gaskin ambassador at fourthworld.com
Thu Mar 25 10:45:00 EDT 2021


The difference between the working and non-working examples seems to be 
limited to the introduction of a delay in the working one, between 
setting the dgData array and later obtaining its text.

Since the array form is what the DG uses internally, perhaps something 
during loading of that array or rendering the UI needs the "wait 0", and 
what you're seeing is a side effect of that internal need.

Being scripted in LC, the DG code could be examined for "wait" or "send" 
to see what's up.

But while the exploration may be fun it would likely be inconsequential, 
since given the general quality of Trevor's work the delay is probably 
not a mistake, but a necessity. That is, you'd learn WHY you need the 
delay, but you'd still need it.

If you do go spelunking in the DG source please let us know what you find.

But now that you've found the solution it may be just as well to use it 
and move on with what you're building.

-- 
Richard Gaskin
Fourth World Systems




Sean Cole wrote:

> Thanks Craig
> 
> This could make some sense. There are a lot of handlers to deal with. I
> thought I was going a bit mad. I’m just going to have to pick my way
> through.
> 
> On Thu, 25 Mar 2021 at 12:44, Craig Newman via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> I have seen this here and there for years, and having nothing to do with
>> dataGrids per se.
>>
>> A handler will fail to run, but will step through in the debugger without
>> issue. This usually resolves, and I never know why.
>>
>> Craig
>>
>> > On Mar 24, 2021, at 5:09 PM, Pi Digital via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>> >
>> > Hi All
>> >
>> > This has been a bit of a mind bender, mainly because in a test stack it
>> works just fine, but...
>> >
>> > Has anyone ever had problems with something like this:
>> >
>> > on myHandle
>> > — ...some code
>> > Set the dgData of grp “myDG” to tDataA
>> > Put the dgText of grp “myDG” into tDataS
>> > — tDataS returns empty
>> > — process tDataS...
>> > end myHandle
>> >
>> > And this:
>> >
>> > on myHandle
>> > — ...some code
>> > Set the dgData of grp “myDG” to tDataA
>> > dispatch “myHandlePt2”
>> > end myHandle
>> >
>> > on myHandlePt2
>> > Put the dgText of grp “myDG” into tDataS
>> > — tDataS returns empty
>> > — process tDataS...
>> > end myHandlePt2
>> >
>> > However, this works:
>> >
>> > on myHandle
>> > — ...some code
>> > Set the dgData of grp “myDG” to tDataA
>> > send “myHandlePt2” to me in 0 sec
>> > end myHandle
>> >
>> > on myHandlePt2
>> > Put the dgText of grp “myDG” into tDataS
>> > — tDataS returns empty
>> > — process tDataS...
>> > end myHandlePt2
>> >
>> >
>> > It seemingly doesn’t have anything to do with data length. I’ve tried
>> forcing a refresh of the grid using dispatch refreshList to it but that
>> makes no difference. Stepping through in the debugger allows it to work or
>> setting a breakpoint, but does not when in full run. Both in standalone and
>> ide.
>> >
>> > A one have any clues why this might not work sometimes?
>> >
>> > Thanks
>> >
>> > Sean Cole
>> > Pi Digital
>> > eMail Ts & Cs





More information about the use-livecode mailing list