DataGrid Error: Trying to Load a Grid on Program Start

zryip theSlug zryip.theslug at gmail.com
Thu Aug 26 17:53:06 EDT 2010


On Thu, Aug 26, 2010 at 9:10 PM, Andrew Kluthe <andrew at rjdfarm.com> wrote:
>
> Hey all,
>
> I have two datagrids that save the data within them to the disk when it is
> changed and reloads from the file on program start.
>
> The files they save are tab delimited lines with the headers in line one.
> This the output of the grid's dgText. On load, if the files are empty except
> for headers it sets the dgData to of this grid to empty.
>
> The calls to load the files from disk appears in the Stack Script and the
> grids themselves are on a card called "LocalData".
>
> I get the following errors whether I set the data to empty or set it to the
> data that is on the disk.
>
> Type: Object: can't set object property
> Object: group "AddTickets" of card "LocalData" of stack
> "C:/FarmOffice/GrainCart/GrainCart.rev"
> Line: set the dgData of me to empty
> Line Num: 0
> Hint: -8
>
>
> AND
>
> 354,0,0,-8
> 90,4128,20
> 449,4128,5,-8
> 535,4128,1,-8
> 241,4128,1,_table.CreateDefaultHeaderGroup
> 353,0,0,button id 1005 of group id 1004 of card id 1002 of stack
> "C:/FarmOffice/GrainCart/Externals/revdatagridlibrary.rev"
> 573,4049,1
> 253,4048,1
> 253,4047,1
> 490,4045,1
> 241,4045,1,_table.CreateHeaders
> 353,0,0,button id 1005 of group id 1004 of card id 1002 of stack
> "C:/FarmOffice/GrainCart/Externals/revdatagridlibrary.rev"
> 573,3951,1
> 241,3951,1,_table.CreateColumns
> 353,0,0,button id 1005 of group id 1004 of card id 1002 of stack
> "C:/FarmOffice/GrainCart/Externals/revdatagridlibrary.rev"
> 573,151,1
> 253,150,1
> 253,113,1
> 241,113,1,_Initialize
> 353,0,0,button id 1005 of group id 1004 of card id 1002 of stack
> "C:/FarmOffice/GrainCart/Externals/revdatagridlibrary.rev"
> 573,4512,18
> 253,4512,1
> 241,4512,1,dgData
> 353,0,0,button id 1005 of group id 1004 of card id 1002 of stack
> "C:/FarmOffice/GrainCart/Externals/revdatagridlibrary.rev"
> 90,3205,36
> 449,3205,5
> 535,3205,1
> 241,3205,1,_table.SetText
> 353,0,0,button id 1005 of group id 1004 of card id 1002 of stack
> "C:/FarmOffice/GrainCart/Externals/revdatagridlibrary.rev"
> 573,4442,1
> 587,4440,1
>
>
> I have tried two different methods for clearing the data to see if it was
> how I was doing it that was causing the errors instead of what I was doing:
>
> 1. I tried using
>
> set the dgData of group "AddTickets" of card "LocalData" to empty
>
> This failed.
>
> 2. I tried putting a command inside of the datagrid that has this code in
> it.
>
> on ClearData
> set the dgData of me to empty
> end ClearData
>
> The code I used to call the handler inside the grid was:
> send "ClearData" to group "AddTickets" of card "LocalData"
>
> I even tried sending the above command in 3 seconds to see if it was that I
> had not properly initialized something when it was executed.
>
>
> The bizarre thing is that I have a third datagrid that holds the last Live
> records in the database and setting it up in all of the above ways mentioned
> works perfectly.
>
> Whats the deal?? I have been pulling my hair out.
>
> --


Hi Andrew,

If I understand well you try to set the content of a datagrid to a
value, and this datagrid is not in a card you load by going in it?
A datagrid is loaded only if you go physically in its card. It's
because the datagrid object is fully initialize when it can execute
its preopencontrol event.

The trick here is to go to the card "LocalData" at startup to preload
the datagrid "AddTickets" then you can set it to empty or to the value
you need.

Example:

on preOpenStack
go to cd "LocalData" -- load the datagrid in this card
go to first cd
set the dgData of grp "AddTickets" to empty
end preOpenStack

Regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc



More information about the use-livecode mailing list