DataGrid getting data from user input
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
DataGrid getting data from user input
I have a main stack with a data grid table. The data that will populate the table needs to come from a substack with fields that a user will fill in and then hit a save button. I've read everything I could about DG's, but only found information on populating with either the contents of the PI or by putting the data itself in the script of the DG. Is there a way to use an on MouseUp handler to tell the program where to put the data?
i.e.
on mouseUp
put fld "date" into tDate
put tDate into --the next available row in the date column of the dg group on the mainstack--
put empty into fld "date"
end mouseUp
Do I even need the variable? Once the data is entered into the DG, the substack the user will use to enter data will be cleared and ready for the next set of data.
?
E
i.e.
on mouseUp
put fld "date" into tDate
put tDate into --the next available row in the date column of the dg group on the mainstack--
put empty into fld "date"
end mouseUp
Do I even need the variable? Once the data is entered into the DG, the substack the user will use to enter data will be cleared and ready for the next set of data.
?
E
Re: DataGrid getting data from user input
Look at the AddLine in the Revolution_Data_Grid.pdf documentation pg 169. I believe this is what you are looking for.
Developing with Windows XP & Revolution 4.5
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
Re: DataGrid getting data from user input
Here is the lesson from the manual that shows how:
How Do I Add A Row Of Data To An Existing Data Grid?
How Do I Add A Row Of Data To An Existing Data Grid?
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Re: DataGrid getting data from user input
Thanks,
I read the dg lesson from Bluemango. I am currently using the 30 day trial of revStudio and the program will not allow me to declare any variables. This seems to be a big part of the problem with using the dg commands.
I type this into a button script:
on mouseUp
put "1" into tEricVariable
put tEricVariable into fld "field"
end mouseUp
and get the error message:
button "Button": compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "tEricVariable", char 12
I can get it to work just fine in revMedia.
Is there something I did to cause the variables to be treated this way in Studio? Do I have a bad install? Is the problem because I have the free 30 day trial version (I don't think so because it works in the 30 day trial for Enterprise).
I'll be re-installing studio tomorrow when I have time, but any input would be great. Still trying to learn and not being able to get the script to work like in the examples is frustrating.
Thanks for the past posts,
E
I read the dg lesson from Bluemango. I am currently using the 30 day trial of revStudio and the program will not allow me to declare any variables. This seems to be a big part of the problem with using the dg commands.
I type this into a button script:
on mouseUp
put "1" into tEricVariable
put tEricVariable into fld "field"
end mouseUp
and get the error message:
button "Button": compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "tEricVariable", char 12
I can get it to work just fine in revMedia.
Is there something I did to cause the variables to be treated this way in Studio? Do I have a bad install? Is the problem because I have the free 30 day trial version (I don't think so because it works in the 30 day trial for Enterprise).
I'll be re-installing studio tomorrow when I have time, but any input would be great. Still trying to learn and not being able to get the script to work like in the examples is frustrating.
Thanks for the past posts,
E
Re: DataGrid getting data from user input
Hi Eric,
The trial is fully functional, whatever version, it seems that your problem is that you have "Strict Compilation Mode" enabled in the preferences, rather than any bad installation issue. If you use the Edit menu and choose Preferences, then pick the "Script Editor" option, you can remove the tick from the "Strict Compilation Mode" box.
Then your script will compile.
Alternatively (as my personal feeling is that the Strict Compilation Mode helps quite a bit in development and especially while learning) you can leave it enabled but get used to explicitly declaring a variable at the appropriate place.
For a global variable (which is literally globally accessible to *any* open stack) you would useat the top of any script page that needs to access it, outside any handler.
Similarly for "Script Local" variables, which you can access from any handler on that page of script you can declare at the top of the page, outside any handler
For local variables which are only accessible to the individual handler itself, and destroyed after the handler exits (ie doesn't keep unnecessary data in memory) then use the variable declaration inside the handler concerned, ie in your caseRunRev does a vary good job of interpreting the values passed to any function or handler without typing, so putting the literal string "1" into the variable is not generally necessary. There are some caveats and options regarding formatting of numbers for display, but mostly you should find that it is convenient to leave a numeric value as numeric.
HTH
SparkOut
The trial is fully functional, whatever version, it seems that your problem is that you have "Strict Compilation Mode" enabled in the preferences, rather than any bad installation issue. If you use the Edit menu and choose Preferences, then pick the "Script Editor" option, you can remove the tick from the "Strict Compilation Mode" box.
Then your script will compile.
Alternatively (as my personal feeling is that the Strict Compilation Mode helps quite a bit in development and especially while learning) you can leave it enabled but get used to explicitly declaring a variable at the appropriate place.
For a global variable (which is literally globally accessible to *any* open stack) you would use
Code: Select all
global gMyGlobalVarName
Similarly for "Script Local" variables, which you can access from any handler on that page of script you can declare at the top of the page, outside any handler
Code: Select all
local sMyScriptLocalVarName
Code: Select all
on mouseUp
local tEricVariable
put "1" into tEricVariable
put tEricVariable into fld "field"
end mouseUp
HTH
SparkOut
Re: DataGrid getting data from user input
Wow,
Thanks SparkOut.
That's exactly the answer I needed. I meant to ask a question about declaring variables, too, thanks for adding that. I have read a lot, but I'm sure from my questions it's obvious I'm just learning.
E
Thanks SparkOut.
That's exactly the answer I needed. I meant to ask a question about declaring variables, too, thanks for adding that. I have read a lot, but I'm sure from my questions it's obvious I'm just learning.
E