How to disable edit_line [closed]

2019-08-07 01:28发布

问题:

I would like to disable a text input field (edit_line in Shoes) for user edition(grey field). I want to have possibility to e.g. set text but I dont want to give that possibility to users. I checked manual but there's nothing about that edit_line, only basics.

回答1:

As answered in the comments session, to disable edit_line you need to pass a state option:
edit_line(state: "disabled")



回答2:

Above answers are perfectly valid! But incase you want to toggle between enabled and disabled state after the edit_line object is created, you can use:

@line = edit_line
@line.state = "disabled" #Disables @line
@line.state = "enabled" #Enables @line back!