zoukankan
html css js c++ java
FLEX光标定位和插入文本
因为目前的FLEX的RichTextEditor不支持图文混编,所以,只能自己动手了,实现最核心的部分,光标定位插入文本。
Code
1
<?
xml version="1.0" encoding="utf-8"?gt;
2
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"gt;
3
<mx:Script>
4
<![CDATA[
5
6
[Bindable]
7
private var textAreaString:String = "textAreaString";
8
[Bindable]
9
private var insertString:String = "|insert|";
10
11
private function insertHandler():void {
12
if (textArea.selectionBeginIndex == textArea.selectionEndIndex) {
13
var startPart:String = textAreaString.substring(0,textArea.selectionBeginIndex);
14
var endPart:String = textAreaString.substring(textArea.selectionEndIndex,textAreaString.length);
15
startPart+=insertString;
16
startPart+=endPart;
17
textAreaString = startPart;
18
}
19
}
20
21
private function changeInsertHandler():void {
22
insertString = insertInput.text;
23
}
24
]]>
25
</mx:Script>
26
<mx:TextArea id="textArea" x="10" y="21" width="298" height="158" text="{textAreaString}"/gt;
27
<mx:Button x="316" y="20" label="Insert" click="insertHandler();"/gt;
28
<mx:TextInput id="insertInput" x="316" y="50" text="{insertString}" change="changeInsertHandler();"/gt;
29
</mx:Application>
30
查看全文
相关阅读:
C#如何调用非托管的C++Dll
CList 点击表头排序 (3)两种排序的第二种
CList 点击表头排序 (2)两种排序方法中其中一种
CList 点击表头排序 (1)SortItems函数
CListCtrl 隔行变色
C++去掉字符串中首尾空格和所有空格
Dialog和FormView如何派生通用类
STL中erase()的陷阱
socket 笔记(一)
prettyJson V7.1 使用
原文地址:https://www.cnblogs.com/zack/p/1434500.html
最新文章
C++11中新特性之:lambda 表达式
【批注】技术选型 -- 绘图 DrawGraphics
svg分图层显示图像
svg整体缩放至指定大小
Algorithm——四数之和
svg与canvas的语法形式区别
svg的transform-matrix详解
chemitry 2 单位、基本定律与元素周期表
Algorithm——Letter Combinations of a Phone Number
TypeScript + node.js + github.api, 实现github快速找到目标用户
热门文章
批量修改string中的字符
用opencv的traincascade训练检测器
文件属性的宏定义
&12-2 查找二叉搜索树
&12 二叉搜索树
&11,散列表
&10 基本数据结构——指针和对象的实现,有根树的表示
&10 基本数据结构——栈,队列和链表
内存插槽
如何优雅的写UI——(1)MFC六大核心机制-程序初始化
Copyright © 2011-2022 走看看