More DataGrid Questions...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
More DataGrid Questions...
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.
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.
Re: More DataGrid Questions...
Hi Phil,
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...
"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
Hm, works fine here!?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?
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...
"LayoutControl" is sent to the datagrid right after the data have been ebtered into the "row templates".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.
"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
Re: More DataGrid Questions...
I will try reinstalling LiveCode. Maybe something has gone wrong in the program, though that seems a long shot.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...
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...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.
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.
Re: More DataGrid Questions...
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.
Hmm... DataGrids seem to be a mystery.
Phil E.
Re: More DataGrid Questions...
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.
Any suggestions?
Phil E.
Re: More DataGrid Questions...
Hi Phil,
sorry, no idea in the moment...
Best
Klaus
sorry, no idea in the moment...
Best
Klaus
Re: More DataGrid Questions...
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.
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.
Re: More DataGrid Questions...
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
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
Re: More DataGrid Questions...
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.
Can I delete the others? How, without disrupting the datagrid's (theoretical) functionality?
Thanks,
Phil E.