Page 1 of 1

Setting static line numbers in a datagrid

Posted: Fri Sep 27, 2013 3:51 pm
by Dr. Linux
Hello all,
Trevor I am still working on my project. I was wondering if there is a way to assign line numbers to individual rows in a datagrid. I tried the ol':
put 2 into theLineNo
#but the data still goes to the 1st row of an empty datagrid. I wanted to assign each computer user to the matching row, so computer 1 is line 1 computer 2 is line two and so on. I'm sure there is way but I can't quite get it. :( Everything else is working great!

Thanks for the help,
Dr. L

Re: Setting static line numbers in a datagrid

Posted: Fri Sep 27, 2013 5:03 pm
by dunbarx
Hi.

Not sure what you need. When you say "assign" a particular user to a particular row, do you mean only to display that information?

Or more likely, do you want to map a user to a particular row?

Have you looked at the "dgDataOfIndex" and the "dgDataOfLine" properties? This would allow you to script in such a way that user 3 only reads and writes to the third line of the DG.

Or am I just missing the point?

Craig Newman

Re: Setting static line numbers in a datagrid

Posted: Fri Sep 27, 2013 7:53 pm
by makeshyft
Craig, thats probably the answer he needed.

The other way that a "number" is available to you is the (pDataArray) in your Datagrids "Row Behavior" Script.

Good luck man...I've been working with Datagrids for a good month or so....I find that they actually work as advertised. But you have to be careful with every step.

Keep at it.... datagrids in Livecode are AMAZING and infinately flexible because you can make your own controls and forms.

Re: Setting static line numbers in a datagrid

Posted: Sat Sep 28, 2013 3:34 pm
by Dr. Linux
Thanks Guys,
I was trying to map information to a particular line. I have 20 computers and when a user logs on I want to pull their information and map it to the computer they are on. So if a user is on computer 3 their information is displayed in row 3 of the activeuser datagrid. The problem I was having is that if no one is on computer 1 or 2 then the information (even if I put 3 into theLineNo) goes to the 1st line of the datagrid not the 3rd. When I log the person off the reference is to line 3 and computer 3 so the data is not effected because the information is actually on line 1. I agree that datagrids are awesome, i can do some great stuff. I know that they are mostly for displaying data so I keep that in mind now while working. I tried to use theDataOfLine and theDataOfIndex when I retrieve the user information. The only problem is putting the info to the right (line). It probably makes things difficult since I have 3 datagrids that I pull information from. I have the machine dg, the user dg and the activeuser dg. The machine dg is a list of computers with their information, the user dg is a list of users with their data and the activeuser dg displays who is on what machine and stores their scores and other specific data which later updates the user and machine dg's.
I was trying to make sure that each computer goes to the correct line. I want to map computer 1 to line one and computer 2 to line 2, etc. Then I can move data in and out and always update the data properly. The machine dg works because the information is static. The aciveuser dg doesn't work because it changes as people logon and off.
Thank you guys,
Dr. L