More DataGrid Questions...

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Gage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 224
Joined: Tue Mar 26, 2013 8:59 pm

More DataGrid Questions...

Post by Gage » Tue May 14, 2013 11:39 pm

I am really trying to mentally grasp what goes on with the DataGrid. I feel that I really get it, and I am doing everything that the tutorials, lessons, and other RunRev material advise, however, they still are not listening to me.

First of all, I have been more concerned with using Forms, not Tables. I have created a file dedicated strictly to testing out the DG, and am currently operating a VERY simple process of positioning and filling data (3 records with 2 items each) into 2 controls on the Row Template.

When I push the "Row Behavior" button in the Property Inspector after creating a DataGrid on my card, nothing happens. Rather, the first time I push the button, an invisible button "Behavior Script" is created on the Row Template card in the respective stack, but it does not bring up the script window, as the tutorials seem to imply it will. Furthermore, once I have pressed the "Row Behavior" button for the first time, and the button exists on the Row Template, the button in the Property Inspector does nothing on any subsequent click. Is this the way it is supposed to function?

Next question: when I am trying to lay out my control, using the LayoutControl handler built into the "Behavior Script", I expect that the default parameter pControlRect will be somehow passed into the handler. This does not appear to be the case; when I use the variable watcher to observe what happens, four seemingly unimportant number are placed in the variable, if it gets populated at all. Do I have to do something other than simply using the " set the dgData of group "My DataGrid" of me to theArray " code in the card script? I am not expressly calling LayoutControl, but I know there is a lot going on behind the scenes, and none of the examples does so.

So, I know this is long; I am trying to include all the necessary details; to recap, my two questions are as follows:
1. My "Row Behavior" button on the Property Inspector is not calling up the script window for any stack I open with a DataGrid Form. Is this normal/what is the function of this button supposed to be?
2. What calls the LayoutControl handler in the behavior script, and where does the pControlRect parameter come from? Mine is not being passed any useful information, even though I have followed all steps presented in the lessons.

Thanks so much. These answers will be my breakthrough!

Phil E.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: More DataGrid Questions...

Post by Klaus » Wed May 15, 2013 3:33 pm

Hi Phil,
Gage wrote:1. My "Row Behavior" button on the Property Inspector is not calling up the script window for any stack I open with a DataGrid Form. Is this normal/what is the function of this button supposed to be?
Hm, works fine here!?
I create a new datagrid, set its TYPE to FORM and then I can click that "Row Behavior" button and the script editor opens.
Must be something else going on...
Gage wrote:2. What calls the LayoutControl handler in the behavior script, and where does the pControlRect parameter come from? Mine is not being passed any useful information, even though I have followed all steps presented in the lessons.
"LayoutControl" is sent to the datagrid right after the data have been ebtered into the "row templates".
"pControlRect" is the "initial" RECT of your complete row template as laid out in the "row template".
You only need to script this, if you need different layouts for the records of your data.

Best

Klaus

Gage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 224
Joined: Tue Mar 26, 2013 8:59 pm

Re: More DataGrid Questions...

Post by Gage » Thu May 16, 2013 4:13 am

Klaus wrote:Hm, works fine here!?
I create a new datagrid, set its TYPE to FORM and then I can click that "Row Behavior" button and the script editor opens.
Must be something else going on...
I will try reinstalling LiveCode. Maybe something has gone wrong in the program, though that seems a long shot.
Klaus wrote:"LayoutControl" is sent to the datagrid right after the data have been ebtered into the "row templates".
"pControlRect" is the "initial" RECT of your complete row template as laid out in the "row template".
You only need to script this, if you need different layouts for the records of your data.
So, truly all I SHOULD have to do is prepare the array and set the dgData of the group "DataGrid" to that array. This supposedly initiates the data population into the fields (assuming my code is correct), and then moves immediately to LayoutControl...

I have inserted break points in both the FillInData and LayoutControl handlers of the behavior script, and am unable to even get the code to be able to run, so I can't really even watch the variables. I think something else is wrong... gonna try the reinstall.

Thanks very much for your response!

Phil E.

Gage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 224
Joined: Tue Mar 26, 2013 8:59 pm

Re: More DataGrid Questions...

Post by Gage » Mon May 20, 2013 3:51 am

Haven't had perfect results from the reinstall, but might be better. It's hard to tell. I think some of my stack are funky... I believe the Row Template sub stack got renamed somehow with a title that the LiveCode engine is unable to interpret.

Hmm... DataGrids seem to be a mystery.

Phil E.

Gage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 224
Joined: Tue Mar 26, 2013 8:59 pm

Re: More DataGrid Questions...

Post by Gage » Thu May 23, 2013 2:54 am

I am still having the issue of DataGrid forms not calling up the Behavior Script buttons' script when I click the Row Behavior button on the Property Inspector. It happens on brand new stacks with brand new DG's, so it's not some funky problem I could have created.

Any suggestions?

Phil E.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: More DataGrid Questions...

Post by Klaus » Thu May 23, 2013 12:35 pm

Hi Phil,

sorry, no idea in the moment...


Best

Klaus

Gage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 224
Joined: Tue Mar 26, 2013 8:59 pm

Re: More DataGrid Questions...

Post by Gage » Fri May 24, 2013 5:00 am

Is it normal for multiple cards to be created in the Data Grid Templates substack when I create a single datagrid in my mainstack?

I always get two, and one appears to be unused by anything, but recently I ended up with six. I didn't create any of them, and with the touchiness I have been experiencing with the datagrids, I am terrified to delete or even modify anything the LC engine creates regarding DataGrids.

Phil E.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: More DataGrid Questions...

Post by Klaus » Fri May 24, 2013 12:54 pm

Hi Phil,

the cards in the template stacks are created automatically!
One card for general info and one card for each datagrid you create in your stack.

So everything seems to be correct in this respect :-)


Best

Klaus

Gage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 224
Joined: Tue Mar 26, 2013 8:59 pm

Re: More DataGrid Questions...

Post by Gage » Fri May 24, 2013 5:35 pm

Correct... but what I am asking about is MULTIPLE cards for a SINGLE datagrid. For instance, I usually get two cards when I drag out one datagrid, which you said seems normal. However, in the current stack I am playing with, there are four cards in the Data Grid Template substack, while I only have one datagrid.

Can I delete the others? How, without disrupting the datagrid's (theoretical) functionality?

Thanks,
Phil E.

Post Reply