开发者

TextInput component not giving up focus?

开发者 https://www.devze.com 2022-12-19 05:25 出处:网络
I have a project where a big part of the UI a notebook, where the user enters text in a number of fields, for which it uses a series of TextInput components.

I have a project where a big part of the UI a notebook, where the user enters text in a number of fields, for which it uses a series of TextInput components. Once the notebook is filled in the user switches to a screen where the inputs are disabled and they compare what they wrote to a 'model answer'. The problem is that the last TextInput to have focus at the time of disabling retains it - it appears disabled (greyed out etc) but if you type the letters appear in the field.

I have tried variations on Se开发者_JAVA技巧lection.setFocus(null), and it seems that Selection.getFocus() returns null/undefined, but can still type into it. I can't select any of the other textfields, and clicking on other interactive elements - bottons etc doesn't seem to want to remove focus either.

UPDATE - Just to make sure there wasn't something crazy happening particular to this project, if I make a nude flash movie with a textInput and a button, then make the button set theTextInput.enabled = false, I can still type into the field. I can't see any way that's a feature.

ANOTHER UPDATE - This is a compiled component or whatever they call that - am I able to actually look at some source anywhere?


Ok, so part of me wants to downvote myself for this, but:

What ended up working was destroying the reference to the actual textfield in the component, like:

myTextInput.label = undefined

This only works because I never need to switch them back on again, but I couldn't retrieve the value of the text entered later on, so I needed to do this bit of nonsense:

var s:String = myTextInput.text;
myTextInput.label = {text:s};

If anyone has any Sensible Ideas, I would like to hear them, but this seems to be doing the job.

0

精彩评论

暂无评论...
验证码 换一张
取 消