DataGrid and my headache

Pete pete at mollysrevenge.com
Wed Sep 7 13:58:26 EDT 2011


Hi Mark,
I think the issue is that "Col 1", "Col 2", etc are just the default names
assigned when you create a new column, nothing special about them.  When
you *set *the dgText [ firstLineContainsColumnNames ], the datagrid expects
the column names to be in the first line of data, so since you didn't rename
the columns, it can't find them.  If you had "Col 1", and "Col 2" in the
first line of data, all would have worked.

Alternatively, you can just set the dgText without
the  [firstLineContainsColumnNames ], omit the column names from the first
line and the datagrid puts the data into the columns from left to right, so
the first tab delimited item goes into the first column, the second item
goes into into column 2, etc.  Doesn't matter about column names that way.
 I prefer to use that method so if I change a column name for some reason, I
don't have to go back and change my set dgText statements. The only problem
with that method is that if you supply more items in a line of data than
there are columns, the datagrid will add extra columns to hold the excess
data.

Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Wed, Sep 7, 2011 at 8:38 AM, Mark Wieder <mwieder at ahsoftware.net> wrote:

> Trevor-
>
> Tuesday, September 6, 2011, 9:32:33 PM, you wrote:
>
> > Odd. I just went through the lesson step-by-step for a third time and it
> > worked just fine. The only change I made was to the name of the data grid
> in
> > the code (as recommended by the instructions). Did you change the column
> > names to "state" and "code"?
>
> Ah. No, I didn't. Is it necessary to name them "state" and "code" for
> this to work? That's already in the first line of the text, so it
> seems like a redundant step. I did make sure the columns were properly
> created and work properly with the extra code added. Do the column
> names "Col 1" and "Col 2" have superpowers?
>
> --
> -Mark Wieder
>  mwieder at ahsoftware.net
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list