datagrid table - no text input possible

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

datagrid table - no text input possible

Post by jawall » Wed Sep 12, 2012 1:58 pm

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

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: datagrid table - no text input possible

Post by sturgis » Wed Sep 12, 2012 2:07 pm

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.
Last edited by sturgis on Wed Sep 12, 2012 2:18 pm, edited 1 time in total.

jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

Re: datagrid table - no text input possible

Post by jawall » Wed Sep 12, 2012 2:13 pm

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

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: datagrid table - no text input possible

Post by sturgis » Wed Sep 12, 2012 2:20 pm

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.

jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

Re: datagrid table - no text input possible

Post by jawall » Wed Sep 12, 2012 2:24 pm

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

UKMC
Posts: 50
Joined: Sun Jan 08, 2017 12:01 pm

Re: datagrid table - no text input possible

Post by UKMC » Wed Feb 01, 2017 4:42 am

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

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: datagrid table - no text input possible

Post by Klaus » Wed Feb 01, 2017 2:17 pm

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

Post Reply

Return to “Mac OS”