Page 1 of 1

DataGrid Cells and Behaviors

Posted: Sat May 21, 2011 1:42 pm
by Simon Knight
Hi,
I am seeking advice on the best way to create a table of data using LiveCode. I need two tables each of 50 rows by 12 columns (i.e not very large). Each cell needs to be associated with a database key and have several encode / decode routines attached or associated. At present my stack files have the encode/decode routines written as a behaviour script. I have edit fields that use the behavior script and have custom properties that hold the database key. My first though was to use a DataGrid but having watched a tutorial video it seems that the individual cell behavior scripts are already used by the datagrid itself. Am I correct and should I be looking to design my own custom table like control?

Thanks

Simon

Re: DataGrid Cells and Behaviors

Posted: Sat May 21, 2011 8:01 pm
by townsend
Here's a little example Stack that should get you started.
It's almost done. The only part that is missing is the Update.
I'll post that as well, as soon as I get that figure out.

Image
Each button calls a Handler. All the Handlers are together in the Stack area.

Re: DataGrid Cells and Behaviors

Posted: Tue May 24, 2011 10:01 am
by Simon Knight
Thanks for the example stack - I'm am progressing forwards slowly with datagrids.

best wishes

Simon

Re: DataGrid Cells and Behaviors

Posted: Tue May 24, 2011 6:59 pm
by townsend
Okay. I finally finished this example! I added the
Update Row in DB Handler. It's very tight code.
Everything done just right-- as best as it can be.

This way, when I copy code, out of here, into my
future projects I'll be starting with a solid foundation.

All the buttons call Handlers in the Main Stack. This way
all the code is in one place, AND if this were going to
be deployed for different screen sizes, all buttons would
call the same Handlers-- thus-- button code would not
need to be copied from one to another.
101 CRUD SQLite 3.2.JPG
101 CRUD SQLite 3.2.JPG (56.28 KiB) Viewed 4138 times