如何以编程方式将Flex TextArea的插入符号移到最后? [英] How do you programmatically move the caret of a Flex TextArea to the end?

查看:168
本文介绍了如何以编程方式将Flex TextArea的插入符号移到最后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在将Flex TextArea中的插入符号从我的代码中追加一些文本到最后。我已经查看了TextArea及其底层TextField的参考文档,但似乎没有提供处理此方法的方法。

我尝试的一种方法是设置将焦点移至文本区域,然后使用设置为结束键的事件键码分派KeyUp KeyboardEvent,但这不起作用。

有关如何这样做吗?



谢谢。

解决方案

试试这个

  textArea.selectionBeginIndex = textArea.length; 
textArea.selectionEndIndex = textArea.length;


I'm trying to move the caret in a Flex TextArea to the end after appending some text from my code. I've looked through the reference documentation for TextArea and its underlying TextField but it appears there is no method provided to handle this.

One approach I've tried is to set focus to the text area and dispatch a KeyUp KeyboardEvent with the event's key code set to the "End" key, but this doesn't work.

Any ideas on how to do this?

Thanks.

解决方案

Try this

textArea.selectionBeginIndex = textArea.length;
textArea.selectionEndIndex = textArea.length;

这篇关于如何以编程方式将Flex TextArea的插入符号移到最后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆