Bill

I totally understand. I struggled with this a few months ago partly because it 
is counter intuitive that I couldn’t just enter text in a field in the DataGrid 
that I could edit and partly because I couldn’t figure out how to do it from 
the docs.  Finally I found the example stack and worked it through.  So I am 
happy to help people avoid the rut I had fallen into on this issue or help 
newbie’s avoid the rut.

Plus if I type it out here I might find just find it again when I forget how to 
do it in a couple of years.  That has happened more than once.  Look online for 
a solution to a problem, find the answer and then find that I had written it. 
:-(

Martin   


> On Apr 27, 2021, at 11:07 AM, William Prothero via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Thanks for your help. I hate to ask such newby questions, but I’m really 
> busy, and what I needed to do seemed so basic.
> 
> Best,
> Bill
> 
> William Prothero
> https://earthlearningsolutions.org
> 
>> On Apr 27, 2021, at 6:51 AM, Martin Koob <mk...@rogers.com> wrote:
>> 
>> 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 
>>> <use-livecode@lists.runrev.com> 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 
>>>>> <use-livecode@lists.runrev.com> 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
>>>> use-livecode@lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your 
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


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

Reply via email to