0
$\begingroup$

I'm having some difficulty understanding how to get input fields to disable dynamically in response to other parts of a ui. Here is an example:

DynamicModule[
    {disable = True, a = "", b = ""}
    ,
    Panel[
        Column[
            {
                Row[{"Field 1: ", InputField[Dynamic[a, TrackedSymbols
                     :> {a, disable}], String, Enabled -> Dynamic[!disable]]}]
                ,
                Row[
                    {
                        "Field 2: "
                        ,
                        InputField[
                            Dynamic[
                                If[disable,
                                    "T"
                                    ,
                                    "F"
                                ]
                            ]
                            ,
                            String
                            ,
                            Enabled -> Dynamic[!disable]
                        ]
                    }
                ]
                ,
                Row[{Checkbox[Dynamic[disable]], " Disable the fields"
                    }]
            }
        ]
    ]
] 

This doesn't work as expected. The second field correctly becomes enabled in response to the checkbox, the first remains stubbornly disabled. I'd understood that using tracked symbols ought to force updating of the field whenever the value of disable changes.

$\endgroup$
2
  • 1
    $\begingroup$ From what I know it is a known bug being worked on. You can use this in a meanwhile: Dynamic@InputField[Dynamic[a], Boxes, Enabled -> (! disable)] $\endgroup$ Commented Aug 18 at 12:50
  • $\begingroup$ That works thank you. $\endgroup$ Commented Aug 19 at 11:56

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.