Create Data Grid under program control
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Create Data Grid under program control
I would like to have a button with a script that will create a new stack (or Sub Stack) and place a Data Grid on it. Is that possible? If so which commands in the dictionary would be the most helpful.
Thanks,
Larry
Thanks,
Larry
-
- VIP Livecode Opensource Backer
- Posts: 9647
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Create Data Grid under program control
Hmmm.
Setting properties of the templateGroup only sets, er, the properties of a new group. It does not recreate the objects within a group. A DG has lots of objects within it.
You can always store a DG somewhere, even containing default or newly loaded data, copy it, and paste it to some target card. This can all be done invisibly.
Craig Newman
Setting properties of the templateGroup only sets, er, the properties of a new group. It does not recreate the objects within a group. A DG has lots of objects within it.
You can always store a DG somewhere, even containing default or newly loaded data, copy it, and paste it to some target card. This can all be done invisibly.
Craig Newman
Re: Create Data Grid under program control
Craig,
It has been years since I tried to 'copy' a data grid and paste the copy in a new place. This was because I always seemed to end up messing up something and I ultimately ended up blaming it on the datagrid construct itself. Are you saying that I should be able to create a DG on a card of one stack and then simply copy it to a card on another stack and it will have all its proper behaviors? (I guess that should be easy to test.)
Larry
It has been years since I tried to 'copy' a data grid and paste the copy in a new place. This was because I always seemed to end up messing up something and I ultimately ended up blaming it on the datagrid construct itself. Are you saying that I should be able to create a DG on a card of one stack and then simply copy it to a card on another stack and it will have all its proper behaviors? (I guess that should be easy to test.)
Larry
Re: Create Data Grid under program control
I just tried copying two datagrids and a couple of buttons along with all the scripts to another new stack. I tested the new stack and it seemed to work properly I saved that new stack. Then I quit Livecode and opened just the new stack and it still seems to work even though it has no Data Grid Templates substack. What gives?
Larry
Larry
Re: Create Data Grid under program control
Craig
Here is my resulting stack. (It is attached and has no substack for templates.) Does it work for you?
The button at the top left is used to connect to any SQLite database and to populate the datagrid at the left with the database's tables and views. If you double click on any one of the resulting tables/views it should show the field names and types in the second data grid. The button at the right does nothing at the moment. Ultimately it is supposed to create a new data grid with the 'selected' fields from the second data grid.
Larry
Here is my resulting stack. (It is attached and has no substack for templates.) Does it work for you?
The button at the top left is used to connect to any SQLite database and to populate the datagrid at the left with the database's tables and views. If you double click on any one of the resulting tables/views it should show the field names and types in the second data grid. The button at the right does nothing at the moment. Ultimately it is supposed to create a new data grid with the 'selected' fields from the second data grid.
Larry
Re: Create Data Grid under program control
I guess I can't send you a LiveCode file even when I change the extension to 'test'.
Re: Create Data Grid under program control
Here is a Dropbox link to the test described above.
https://www.dropbox.com/s/m21amyklglsfr ... ecode?dl=0
Larry
https://www.dropbox.com/s/m21amyklglsfr ... ecode?dl=0
Larry