datagrid and customproperties

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
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

datagrid and customproperties

Post by jalz » Fri Jan 30, 2015 12:49 am

Hi Guys,

I need some help please with a custom property issue I'm encountering in a datagrid. I have a datagrid setup as a form and inside the dg, I have a 3 of fields, all labelled appropriately. However when I populate the grid, it seems to only accept values into "Label 2", "Label 3", "Label 4" which isn't a problem as I've commented it in my code as to what the source fields they are.

The problem is, I have custom properties assigned to each of those three fields, and I can't seem to set any of the values in them. When I try running the code, the code seems to break. Can someone look at my syntax and help me to get a value in my custom properties.

Thanks in advance

Code: Select all

//this line works as it populates my field called fld_line_total
put currency(item 4 of tLine) into tDataA[tCounter]["Label 2"]
//this line does not work, but I definitely have a custom property associated to my field
//fld_line_total which is interpreted in the dg as Label 2
set the c_line_total of field tDataA[tCounter]["Label 2"] to (item 4 of tLine)


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

Re: datagrid and customproperties

Post by Klaus » Fri Jan 30, 2015 1:33 pm

Hi Jalz,

problem is that the single objects (fields etc.) that make a datagrid group are NOT named like the keys in its "the dgdata" array!
Unfortunately that is not documented at all.


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: datagrid and customproperties

Post by dunbarx » Fri Jan 30, 2015 3:49 pm

Datagrids.

OK, the fields in a DG are named with monikers like "HeaderLabel" and "Col 1 0002". If you make a small test DG and populate it with a few columns and a few lines, you can:

Code: Select all

put "Test" into  field "Col 1 0002"
Similarly, you can set and get any custom properties of any of those fields, as long as you reference them the way the DG likes. You are under its influence, and it is hard to make it see reason.

Craig

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: datagrid and customproperties

Post by jalz » Sat Jan 31, 2015 1:44 am

Thanks to both of you for your replies. Got it working in the end, syntax was correct but I was trying to set the dgdata in the wrong handler, I should have been setting the custom properties via the FillInData Handler. Wish run rev would release a datagrid like control, but something that was a lot more easier to use.

Post Reply