Re: DataGrid and my headache

2011-09-02 Thread Bob Sneidar
Was this copied and pasted from your code or did you retype it? Check the name 
of the datagrid just to be certain. Then if you still have a problem, delete 
the datagrid and try again. 

Bob


On Sep 2, 2011, at 12:49 PM, Inselfan wrote:

> Hola,
> 
> Working with RR/LC since 1997 (my actual Version: LC 4.5.3). Now I want to
> start working with something new to me: DataGrid. And it's making me mad.
> 
> Doing the exercises as described and also made a Data Grid "field" from the
> Tool-bar with the name DataGrid1.
> 
> on mouseUp
>   put "state" & tab & "code" & cr & \
>  "ALABAMA" & tab & "AL" & cr & \
>  "ALASKA" & tab & "AK" into theText
>   put true into firstLineContainsColumnNames
>   set the dgText[firstLineContainsColumnNames] of group "DataGrid1" to
> theText
> end mouseUp
> 
> gives me a permanent error: 
> button "Button": execution error at line 12 (Chunk: can't find background),
> char 49
> 
> I also can not find all the "dg*" words in the dictionary. Do I miss
> something, what also has to be installed?
> 
> It would be so kind, if you'll be able to kick me in the right direction.
> 
> Thanks a lot
> 
> Horst
> 
> --
> View this message in context: 
> http://runtime-revolution.278305.n4.nabble.com/DataGrid-and-my-headache-tp3786924p3786924.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> ___
> 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: DataGrid and my headache

2011-09-02 Thread Pete
Don't see anything obvious wrong with your code except possible name
misspellings, but unfortunately, the dictionary is pretty silent on anything
related to the datagrid.  However the data grid manual has a section at the
end that lists all the properties, commands and functions that are available
Pete
Molly's Revenge 




On Fri, Sep 2, 2011 at 12:49 PM, Inselfan  wrote:

> Hola,
>
> Working with RR/LC since 1997 (my actual Version: LC 4.5.3). Now I want to
> start working with something new to me: DataGrid. And it's making me mad.
>
> Doing the exercises as described and also made a Data Grid "field" from the
> Tool-bar with the name DataGrid1.
>
> on mouseUp
>   put "state" & tab & "code" & cr & \
>  "ALABAMA" & tab & "AL" & cr & \
>  "ALASKA" & tab & "AK" into theText
>   put true into firstLineContainsColumnNames
>   set the dgText[firstLineContainsColumnNames] of group "DataGrid1" to
> theText
> end mouseUp
>
> gives me a permanent error:
> button "Button": execution error at line 12 (Chunk: can't find background),
> char 49
>
> I also can not find all the "dg*" words in the dictionary. Do I miss
> something, what also has to be installed?
>
> It would be so kind, if you'll be able to kick me in the right direction.
>
> Thanks a lot
>
> Horst
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/DataGrid-and-my-headache-tp3786924p3786924.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> ___
> 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: DataGrid and my headache

2011-09-02 Thread Mark Wieder
Horst-

Friday, September 2, 2011, 12:49:17 PM, you wrote:

> It would be so kind, if you'll be able to kick me in the right
> direction.

The example is incomplete (aka "wrong"). Try the following... the
inserted text is from the more complete example at

http://lessons.runrev.com/s/lessons/m/datagrid/l/36470-How-do-I-create-a-Datagrid-dynamically-from-tab-delimited-data

on mouseUp pMouseBtnNo
local theText
local firstLineContainsColumnNames
local theColumns

put "state" & tab & "code" & cr & \
"ALABAMA" & tab & "AL" & cr & \
"ALASKA" & tab & "AK" into theText

--create columns
put line 1 of theText into theColumns
--no empty column names are allowed, so I insert a space when that happens
replace tab & tab with tab & " " & tab in theColumns
replace tab with return in theColumns
set the dgProp["columns"] of group "DataGrid 1" to theColumns

put true into firstLineContainsColumnNames
set the dgText[firstLineContainsColumnNames] of group "DataGrid 1" to 
theText
end mouseUp

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
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: DataGrid and my headache

2011-09-06 Thread Trevor DeVore
On Fri, Sep 2, 2011 at 8:40 PM, Mark Wieder  wrote:
>
> The example is incomplete (aka "wrong"). Try the following... the
> inserted text is from the more complete example at
>

Actually the example is not incomplete. The code snippet is from this
lesson:

http://lessons.runrev.com/s/lessons/m/datagrid/l/7303-How-Do-I-Create-My-First-Data-Grid-Table-

The lesson first has you create the columns and then run the code snippet.
If you create the columns as described in the lesson then the code snippet
works fine (assuming you have a data grid named "DataGrid1").

Horst - the problem is most likely that you created a Data Grid field and
the example lesson you are going through works with a data grid table. Try
going through the lesson again and create a table. Does it work?

-- 
Trevor DeVore
Blue Mango Learning Systems

LiveCode Resources for Developers: http://livecode.bluemangolearning.com
___
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: DataGrid and my headache

2011-09-06 Thread Mark Wieder
Trevor-

Tuesday, September 6, 2011, 7:29:26 AM, you wrote:

> On Fri, Sep 2, 2011 at 8:40 PM, Mark Wieder  wrote:
>>
>> The example is incomplete (aka "wrong"). Try the following... the
>> inserted text is from the more complete example at
>>

> Actually the example is not incomplete. The code snippet is from this
> lesson:

Sorry, Trevor. I *did* work through the lesson before posting my
response. The code in the lesson does *not* work the way it's listed.
All it does is clear out the datagrid entries. And I just ran through
the steps again to make sure I wasn't mistaken earlier.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
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: DataGrid and my headache

2011-09-06 Thread Trevor DeVore
On Tue, Sep 6, 2011 at 8:55 PM, Mark Wieder  wrote:

> Sorry, Trevor. I *did* work through the lesson before posting my
> response. The code in the lesson does *not* work the way it's listed.
> All it does is clear out the datagrid entries. And I just ran through
> the steps again to make sure I wasn't mistaken earlier.


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"?

-- 
Trevor DeVore
Blue Mango Learning Systems

LiveCode Resources for Developers: http://livecode.bluemangolearning.com
___
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: DataGrid and my headache

2011-09-07 Thread Mark Wieder
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
 mwie...@ahsoftware.net


___
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: DataGrid and my headache

2011-09-07 Thread Bob Sneidar
I made the same mistake at first. There are column LABELS and column NAMES. 
They can be different, and it can be a gotcha. It's the column NAMES that are 
important. It's actually a good thing, as I discovered I could use an array 
from sqlYoga by calling sqlquery_retrieveAsArray, and then set the datagrid 
data using set the dgData of group "myDataGrid1" to that array. Any datagrid 
columns named the same as the sql columns will display the data, but NOT 
discard the "invisible" data. That remains intact and accessible using the 
dgDataOfIndex[indexnum] making the datagrid array a kind of sql temporary 
storage. Now I can reference the unique key which is invisible to the user when 
I want to update my sql table, along with any other data from the table. 

In one project I have a datagrid that is a part of a repeating background on 
several cards that act as forms for various sql tables. In my opencard handler, 
I get a property of the card containing the sql column names I want to display 
along with widths and column labels. I set the 3 properties of the datagrid 
called dgProp["columns"], dgProp["widths"] and dgprop["labels"] from that saved 
property data, I get the sql data as an array, and I set the dgData of the 
datagrid to that. I now have a method that will work with any sql table now 
using the same code in any of my future projects. 

If you intend to do a lot of work with datagrids, I would get used to using the 
array functions as opposed to the text functions as soon as possible. Parsing 
the text with all the repeat loops and what have you turns out to be much more 
troublesome in the long run. 

Bob


On Sep 7, 2011, at 8:38 AM, Mark Wieder 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
> mwie...@ahsoftware.net
> 
> 
> ___
> 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: DataGrid and my headache

2011-09-07 Thread Pete
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 




On Wed, Sep 7, 2011 at 8:38 AM, Mark Wieder  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
>  mwie...@ahsoftware.net
>
>
> ___
> 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: DataGrid and my headache

2011-09-07 Thread Mark Wieder
Pete-

Wednesday, September 7, 2011, 10:58:26 AM, you wrote:

> 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.

OK - got it. Setting the dgText doesn't apply names to columns, even
if firstLineContainsColumnNames is true. It *matches* the names in the
first line to already-existing names in the header and puts the data
into the matching column, if it exists. That makes some sense, and
even offers a lot of flexibility. But it certainly isn't intuitive,
and there's no way I could have gotten that from the lessons online.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
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: DataGrid and my headache

2011-09-07 Thread Mark Wieder
Bob-

Wednesday, September 7, 2011, 9:16:49 AM, you wrote:

> If you intend to do a lot of work with datagrids, I would get
> used to using the array functions as opposed to the text functions
> as soon as possible. Parsing the text with all the repeat loops and
> what have you turns out to be much more troublesome in the long run. 

Yeah, that's what I do, I was just following up on the lesson to see
about getting the OP started. The PowerTools widgets display is a
datagrid with thumbnail snapshots, openable folders, and drag'n'drop
operations. It would be a nightmare trying to do all that without
multidimensional arrays behind the datagrid.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
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


FIXED Re: DataGrid and my headache

2011-09-03 Thread Inselfan
Thanks to all,

Mark, your example did the trick and will kick me the right direction :)
thank you for that. So I will be able to continue now... 

--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/DataGrid-and-my-headache-tp3786924p3787813.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
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