Re: Set and get dgData and dgText delay

2021-03-30 Thread Sean Cole (Pi) via use-livecode
Hi all,
After much fiddling with the code and looking into the depths of LC core
code I've found what happens, and it's all to do with message flow.
This way works as expected:
1. I create an array from Data
2. Apply data to DataGrid using set dgData
3. Read from data in the same handler or sub handler using 'put dgData into
myArray'

This way sometimes does not:
1. Create an array from Data
2. Apply data to DataGrid using set dgData
3. Read from data in the same handler or sub handler using 'put dgText into
myData'

This way definitely does not:
1. Apply data to DataGrid using set dgText
2. Read from data in the same handler or sub handler using either 'put
dgText into myData' or 'put dgData into myArray'

dgText does not get processed from either dgText input or from dgData input
during the message flow until it reaches either the end of the entire
message flow or a 'Send "myHandler" in 0 sec'. myHandler will be able to
read from the dgText because it will have been processed between the
original message flow completing and myHandler beginning it's message flow.

There does not appear to be a way to force the DG library into processing
the cached data from 'set dgData' into the string required for 'get
dgText'.

So, for my use case, I have switched to creating a simple function to
convert the TSV data into an array then apply to the grid as dgData. Then,
if I need to read from it in the same message chain/flow I grab the dgData
(which is always available unless set to non-persistent) and process the
data from the array (which works out better in the long run anyway).

Sean

On Thu, 25 Mar 2021 at 18:11, Sean Cole (Pi)  wrote:

> Thanks Bob, but the columns are defined, both in my test stack and the
> project stack. It gets filled once the scripts have finished running, so it
> can't be that which is the issue in this instance. But thanks once again
> for your input.
>
> Sean
>
> On Thu, 25 Mar 2021 at 17:55, Bob Sneidar via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
>> DGText will only contain data for the columns you have defined in the
>> Datagrid properties. If your dgData array keys have no matching columns it
>> will still populate the dgData but dgText will return empty. This is why I
>> avoid using dgText at all anymore.
>>
>> I have also noticed that if one of the row arrays in the dgData is empty
>> then that can bork the data grid. You have to set the dgData to empty to
>> get rid of it.
>>
>> Bob S
>>
>>
>> On Mar 25, 2021, at 5:44 AM, Craig Newman via use-livecode <
>> use-livecode@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
>>
>> ___
>> 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
>>
>
___
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: Set and get dgData and dgText delay

2021-03-25 Thread Sean Cole (Pi) via use-livecode
Thanks Bob, but the columns are defined, both in my test stack and the
project stack. It gets filled once the scripts have finished running, so it
can't be that which is the issue in this instance. But thanks once again
for your input.

Sean

On Thu, 25 Mar 2021 at 17:55, Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

> DGText will only contain data for the columns you have defined in the
> Datagrid properties. If your dgData array keys have no matching columns it
> will still populate the dgData but dgText will return empty. This is why I
> avoid using dgText at all anymore.
>
> I have also noticed that if one of the row arrays in the dgData is empty
> then that can bork the data grid. You have to set the dgData to empty to
> get rid of it.
>
> Bob S
>
>
> On Mar 25, 2021, at 5:44 AM, Craig Newman via use-livecode <
> use-livecode@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
>
> ___
> 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
>
___
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: Set and get dgData and dgText delay

2021-03-25 Thread Bob Sneidar via use-livecode
DGText will only contain data for the columns you have defined in the Datagrid 
properties. If your dgData array keys have no matching columns it will still 
populate the dgData but dgText will return empty. This is why I avoid using 
dgText at all anymore.

I have also noticed that if one of the row arrays in the dgData is empty then 
that can bork the data grid. You have to set the dgData to empty to get rid of 
it.

Bob S


On Mar 25, 2021, at 5:44 AM, Craig Newman via use-livecode 
mailto:use-livecode@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

___
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: Set and get dgData and dgText delay

2021-03-25 Thread Sean Cole (Pi) via use-livecode
I’ve tried using wait, wait with messages, wait until. No joy.

But in a separate test stack with the same data it works just fine having
them one after the other.

There is no sense to it NOT passing the text one line to the next.

I thought it might be because it was located in a preOpenCard script but
moving it into the openCard or even 0sec after the open card in another
handler made no difference.

The real issue here is that the same stack worked ok before so there is
something we have done that upset it. I’m just going to have to pick my way
through till I find what is preventing the Dg from carrying out its
function. In the background.

On Thu, 25 Mar 2021 at 14:45, Richard Gaskin via use-livecode <
use-livecode@lists.runrev.com> wrote:

> 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
>
>
> ___
> 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
>
-- 
Pi Digital
___
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: Set and get dgData and dgText delay

2021-03-25 Thread Richard Gaskin via use-livecode
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



___
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: Set and get dgData and dgText delay

2021-03-25 Thread Sean Cole (Pi) via use-livecode
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@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@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
> >
> > ___
> > 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
>
>
> ___
> 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
>
-- 
Pi Digital
___
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: Set and get dgData and dgText delay

2021-03-25 Thread Craig Newman via use-livecode
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 
>  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
> 
> ___
> 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


___
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