Hi

I wanted to give you more of an explanation of how to get enter text in field 
to work. Just refreshing my own memory I had to go back to my project.  

So as Håkan said you have to first allow editing.   

Then you can’t just enter text into a cell and have it deal with it.  You have 
to use a Datagrid command EditTextField

Here is the handler I use in my project which I adapted from the DG7 form of 
the DGForms.zip file that you can download here:
https://forums.livecode.com/viewtopic.php?f=7&t=20130


--------------------
on mouseDoubleUp pMouseBtnNum

local theKey


-- Example of how to edit the contents of a field.

-- By passing the index of the record associated with copy of this template 
being displayed and

-- a key (array key) the data grid will automatically save the changes the user

-- makes and refresh the UI by calling FillInData and resizeControl.

if pMouseBtnNum is 1 then

     if the dgProps["allow editing"] of the dgControl of me then

          put the short name of the target into sEditedField

          switch sEditedField

               case "RaterComments"

                   put "CriteriaComments" into theKey

                   EditFieldText the long id of the target, the dgIndex of me, 
theKey

                   break

                case "title"

                    put "title" into theKey

                    EditFieldText the long id of the target, the dgIndex of me, 
theKey

                    break

           end switch

      end if

end if

pass mouseDoubleUp
end mouseDoubleUp


——————

Hope this helps.

Martin Koob


> On Apr 27, 2021, at 8:20 AM, hakan--- via use-livecode 
> <[email protected]> wrote:
> 
> On the second tab in the preferences pane there is a checkbox that says 
> ”Allow text editing”. If you have that selected you can edit the text by 
> double-clicking a cell.
> 
> Or do you need something else?
> 
> :-Håkan
> 
>> On 26 Apr 2021, at 21:03, William Prothero via use-livecode 
>> <[email protected]> wrote:
>> 
>> Folks:
>> I’m wanting to use a datagrid to store data that I enter by hand.
>> 
>> Seems this oughta be quite simple, but ….. messing with the docs is 
>> frustrating.
>> 
>> I want to be able to click on an empty cell in a datagrid, have it open, and 
>> enter a number or text. Then I want to store the values to a file. I have no 
>> problem with using dgArray to get the data and store it, but the simple act 
>> of opening a cell so I can enter a number eludes me.
>> 
>> I’m sure there must be tutorials, but I guess I’m impatient to sort through 
>> them. When I started looking around, I see there’s a problem trying to enter 
>> data into an empty cell. I need to do this. The cells with data open and let 
>> me enter values when I double click, but ……. empty ones?
>> 
>> Could somebody point me to a tutorial that lets me do this simple task with 
>> a datagrid?
>> 
>> Thanks,
>> Bill
>> _______________________________________________
>> use-livecode mailing list
>> [email protected]
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to