Simple? DG question

Phil Davis phil at pdslabs.net
Tue Feb 15 19:05:21 EST 2022


Sean, you hit the nail on the head! Thank you! After updating the 
'answer' field, I added this code:

             -- update the DG internal array
             put fld "answer" of me into tDataA["answer"]
             put fld "question" of me into tDataA["question"]
             set the dgDataOfIndex [ the dgIndex of me ] of the
    dgControl of me to tDataA

Now it works perfectly.

You are the MAN!!!  :-)

Phil


On 2/15/22 3:40 PM, Pi Digital via use-livecode wrote:
> When the user clicks on the toggle, do you have script that is overwriting the dgData or dgText and then invoking a redraw of the form? Or are you only changing the state of the graphic? Ideally you want to change the data and allow it to redraw the grid again.
>
> I’m coding the same myself at this very moment for a project I’m on where I want layers to be made visible and invisible. I’m allowing the user to mouseUp on an SVG widget with the ‘eye open’ iconPresetName which then calls a handler with the layer number and the target (which is the ‘visibility’ widget) which adjusts the data for the grid and rewrites to it by using ‘set the dgDataOfIndex[pLayerNum] to pVisible' or something like it. Once all the handlers are complete it redraws the grid with the updated visibility icon.
>
> Does that help?
>
> Sean Cole
> Pi Digital Productions Ltd
>
> eMail Ts & Cs
>
>
>> On 15 Feb 2022, at 22:03, Phil Davis via use-livecode<use-livecode at lists.runrev.com>  wrote:
>>
>> Hi folks,
>>
>> I have a 'form' Data Grid where each line's data objects are:
>> - a 'question' text field whose value is set once and never changed.
>> - an 'answer' text field whose value is set by the user's interaction with a 2-state 'answer' group.
>>
>> When the user clicks/taps the 2-state 'answer' group, its visual state changes to acknowledge the tap, and its new state (true or false) is put into the 'answer' text field. I have verified that this part works, and the toggle object is setting the value of the 'answer' text field to reflect the visual state of the toggle object.
>>
>> My problem:
>> For some reason, the dgText and dgData of the data grid only contain 'false' as the answer values from every line in the DG, regardless of the toggle settings (and therefore the text values in the 'answer' fields). Like this:
>>
>>    false    Fever above 100°F
>>    false    Unexplained body aches or pain
>>    false    Coughing
>>    false    Sore throat
>>    false    Chills
>>
>> What am I missing?
>>
>> Thanks for any insight you can offer.
>>
>> -- 
>> Phil Davis
>> 503-307-4363
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

-- 
Phil Davis
503-307-4363


More information about the use-livecode mailing list