DataGrid anomaly?

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

DataGrid anomaly?

AndyP via use-livecode
Hi

I have a stack that opens a data stack imports an array, processes it and
displays the results in a DataGrid Table - pretty straight forward and
simple stuff - and all handlers work as they should.

Here is the code in the "Open File" button

*on* mouseUp

   retrieveData

   augmentDataArray

   displayDataInDataGrid  -- problem handler

*end* mouseUp

All handlers are card Scripts.


The handler causing problems is

*command* displayDataInDataGrid

   *put* createTabbedDataList() into tTabbedDataList

   *set* the dgText of *group* "dgDataDisplay" to tTabbedDataList  -- line
155

*end* displayDataInDataGrid


When called from the "Open File" button I get the following error

*  card id 1002: execution error at line 155 (Chunk: can't find
background), char 1*

However when I remove the call in the "Open File" script and call

displayDataInDataGrid from a different mouseUp handler  it works perfectly.

Can anyone shed light on this.


I'm Using LC 9.0 Indy and have tried it in LC Indy 8.1.9

Thanks for any help.

--
Regards


Ian McKnight

[hidden email]
=======================

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_8474091317351636961_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
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 anomaly?

AndyP via use-livecode
First, I'm curious why you are not simpy setting the dgData to an array. But that aside, what is the name of your datagrid? The error is indicating there is no group by that name on the current card. Another thing that can throw you is if the stack is opened modally. Then it's not the topStack, so relative references will be for the currentCard of the topStack.

In your button try:
put getParentCard(the long id of me) into tThisCard

then when you refer to your datagrid use group "dgDataDisplay" of tThisCard (assuming it's on the same card as the button)

Put this handler in a library or in the script of your button:

function getParentCard pObjectID
   put offset("card id", pObjectID) into tStartChar
   put char tStartChar to -1 of pObjectID into tCardID
   return tCardID
end getParentCard

Bob S


> On Apr 11, 2018, at 06:53 , Ian McKnight via use-livecode <[hidden email]> wrote:
>
> createTabbedDataList


_______________________________________________
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 anomaly?

AndyP via use-livecode
In reply to this post by AndyP via use-livecode
Also what happens when you step through the code?

Bob S


> On Apr 11, 2018, at 06:53 , Ian McKnight via use-livecode <[hidden email]> wrote:
>
> createTabbedDataList


_______________________________________________
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 anomaly?

AndyP via use-livecode
Thanks Bob - that works fine.

I had tried referencing group "dgDataDisplay" of this card - but that
didn't work. So I need to be more precise in naming the card!
My stack is a plain vanilla stack with a few buttons and a dataGrid on one
card.

When I step through the code the error occurs at line 155 but *only* when
its called with the other handlers in the main button. It doesn't fail when
the 'displayDataInDataGrid' handler is called from a different button.

As to why I didn't set the dgText to an array - I thought it had to be a
tabbed list (My array keys contain 2 or 3 sub keys and the main key needs
to be decoded to provide a date, which is displayed along with the stored
data and other info calculated on the fly)

Again - Many thanks for your help

On 11 April 2018 at 15:41, Bob Sneidar via use-livecode <
[hidden email]> wrote:

> Also what happens when you step through the code?
>
> Bob S
>
>
> > On Apr 11, 2018, at 06:53 , Ian McKnight via use-livecode <
> [hidden email]> wrote:
> >
> > createTabbedDataList
>
>
> _______________________________________________
> 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
>



--
Regards


Ian McKnight

[hidden email]
=======================

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
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