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

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

问题描述

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

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.

我尝试过的一种方法是将焦点设置到文本区域并调度 KeyUp KeyboardEvent 并将事件的键代码设置为End"键,但这不起作用.

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?

谢谢.

推荐答案

试试这个

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

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

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