Page 1 of 1

datagrid table - no text input possible

Posted: Wed Sep 12, 2012 1:58 pm
by jawall
Hey everyone,

On Mac OS X 10.6.8 I created (my first) data grid table in LiveCode 5.5.2. Even though I have set "allow editing" (or "allow text editing" in the inspector pane) to "true" it's not possible to double-click a cell and enter something in in it as described in the documentation.

I have a copy of the stack at outsidenow.de/livecode/datagrid.livecode.zip in case anyone needs to take a look at it in order to help me.

Thank you all!
Jawall

Re: datagrid table - no text input possible

Posted: Wed Sep 12, 2012 2:07 pm
by sturgis
You can only edit existing cells using the default scripts. It is probably possible to script it so that a double click on a part that has no data will pop up a dialog to fill in the data for a new row. THe double click editing though does work with your datagrid as long as there is data already in the cell.

###EDIT
######
Just did a quick experiment, you would probably want to set up a custom dialog box of some type to do this, but for a quick experiment you could add the following script to the group level of the grid. (select the group, click code, put the code in and appy it)

Code: Select all

on mousedoubleup
   ask "enter info for column 1" -- prompt for the first column data
   put it into theDataA["Col 1"] -- put it into an array. YOu'd want to validate the data of course
   ask "enter info for column 2"-- same for column 2
   put it into theDataA["Col 2"] -- the array keys match the column names
   put 1 into theLineNo -- this determines where the data will be inserted into the grid
   dispatch "AddData" to group "grid" with theDataA,theLineNo -- actually does the insert sending the array, and the line num
   if the result is not a number then -- check for error, if there was one, pop up a message
      answer information "There was a problem: " && the result
   end if
end mousedoubleup
The way the datagrid is set up, if the user double clicks a field that already exists, the normal edit procedure occurs. If not, the message is passed up to the group level and this script prompts for info then shoves it into the grid.

Re: datagrid table - no text input possible

Posted: Wed Sep 12, 2012 2:13 pm
by jawall
Thanks for the quick answer.

Am I getting you right? In order to directly enter some text into an (existing) cell in a dataGrid table, this cell must contain some value (e.g. text) already? If it is an empty cell, I cannot double-click and then enter text?

That is confusing, chapter "how-do-i-open-a-table-cell-for-editing" in the DataGrid tutorial states: "By default a table cell can be edited if the user double-clicks on the cell. "

jawall

Re: datagrid table - no text input possible

Posted: Wed Sep 12, 2012 2:20 pm
by sturgis
Yes this is right. As mentioned though, its easy enough to set up a simple form to add data to the grid or simply prompt the user like I did in the example i added above.

Re: datagrid table - no text input possible

Posted: Wed Sep 12, 2012 2:24 pm
by jawall
I should have checked it myself before I replied to your first answer. You are perfectly right! The documentation did not lead me in the right direction here. Thank you also for the testing code. I'll easily find a way, now that I know...

Thank
Jawall

Re: datagrid table - no text input possible

Posted: Wed Feb 01, 2017 4:42 am
by UKMC
I built a demostack with a datagrid which is editable - on windows, everything works perfect.

When making a HTML5 standalone App, there is no possibility to edit the contents.
Its clear to me that changes cannot be saved into the stack (as it is a standalone), but as I read on other places, editing should be possible (for example to store them in a database)

I hope there is someone out there who can give me a hint.

Best regards

Ulrich

Re: datagrid table - no text input possible

Posted: Wed Feb 01, 2017 2:17 pm
by Klaus
Hallo Ulrich,

we have a dedicated HTML5 forum, so it might be a better idea to post
a new question over there instead of hijacking an old thread in the Mac forum.

HTML5 forum: http://forums.livecode.com/viewforum.php?f=120


Best

Klaus