元件是輔助選擇的文字框,可以使用上下鍵選擇,可以採用自定義資料,可以和後台進行互動,需要用到元件remoteconn(已貼出)
元件**:
package pizazz.flex4.component;
protected var _rowcount:uint = 10;
protected var _popuplist:list;
protected var _labelfield:string = "";
protected var _datafield:string = "";
protected var _iscustomdata:boolean = false;
protected var _dataprovider:ilist;
protected var _wait:uint = 500;
private var _changefunction:function;
private var _parsefunction:function;
private var _isquickselect:boolean = true;
private var _value:string = "";
private var _destination:string;
private var _method:string = "loadname";
private var _source:ilist;
private var _keyindex:int = -1;
private var _container:skinnablecontainer;
private var _remote:remoteobject;
private var _showingpopup:boolean = false;
private var _timer:timer;
/*** 設定快速匹配,當輸入和自動選擇相同時,自動匹配
*/
public function set isquickselect(value:boolean):void
/*** 設定value值,備用取值引數
*/ public function set value(value:string):void
/*** 獲取value值,備用取值引數
*/ public function get value():string
/*** 設定選擇時呼叫函式
*/ public function set changefunction(value:function):void
/*** 設定自定**析函式(只對自定義資料來源有效)
*/ public function set parsefunction(value:function):void
/*** 設定通道描述
*/ public function set destination(value:string):void
/*** 設定查詢方法
*/ public function set method(value:string):void
/*** 設定處理後顯示最大數目
*/ public function set rowcount(value:uint):void
/*** 設定顯示字段
*/ public function set labelfield(value:string):void
/*** 設定value欄位
*/ public function set datafield(value:string):void
/*** 設定查詢引數
*/ public function set param(value:object):void
/*** 設定自定義資料來源
*/ public function set dataprovider(value:ilist):void
/*** 獲取資料源
*/ public function get dataprovider():ilist
/*** 是否採用自定義設定資料來源
*/ public function set iscustomdata(value:boolean):void
public function autotextinput()
/*** 重置連線
* @param destination 通道描述
* @param param 查詢引數
* @param method 查詢方法
*/ public function resetremote(destination:string,
param:object = null, method:string = ""):void);
text = "";
_value = "";
_param = param;
if(method != "")}}
/*** 清除資料
*/ public function clear():void
override protected function createchildren():void
override protected function focusouthandler(event:focusevent):void
super.focusouthandler(event);
}private function inithandler(event:event):void);
}seteventlisteners();
}private function seteventlisteners():void
private function resulthandler(event:resultevent):voidelse if(_result is arraycollection)else if(_result is ilist)
if(_impl)
return;}}
removehandler(event);
}private function changehandler(event:event):voidelse
}private function dochangehandler(event:timerevent):void;
if(_destination != null)else if(_iscustomdata)
}private function listchangehandler(event:event):void
removehandler(event);
}private function createhandler(event:event):voidelse
point = _container.parent.globaltolocal(point);
if (point.y + _container.height > screen.height && point.y >
(height + _container.height))else
point.x = math.min(point.x, screen.width -
_container.getexplicitormeasuredwidth());
point.x = math.max(point.x, 0);
if (_container.x != point.x || _container.y != point.y)
if(!_container.visible)
//end
}private function removehandler(event:event):void
}private function listselecthandler():object
protected function quickselect(impl:ilist):void
}protected function downhandler(event:keyboardevent):voidelse if(event.keycode == 38)else if(event.keycode == 13)
event.stoppropagation();}}
protected function parsecustomdata():ilist
if((_item[_labelfield] + "").indexof(text) != -1)
}return _result;}}
}
元件執行:
檢視:[img]
隨記文字框只可以輸入數字
nkeyup value value.replace d g,只允許輸入數字 整數 小數點不能輸入 text onkeyup value value.replace d g,允許輸入小數 兩位小數 text onkeyup value value.replace d d d g,1 允許輸入小數 一...
文字框的樣式
文字框樣式大全 收藏 輸入框景背景透明 滑鼠劃過輸入框,輸入框背景色變色 style width 106 height 21 nm use ut this.style.bordercolor black this.style.backgroundcolor ffffff style border w...
文字框的測試
如何對文字框進行測試 a,輸入正常的字母或數字。b,輸入已存在的檔案的名稱 c,輸入超長字元。例如在 名稱 框中輸入超過允許邊界個數的字元,假設最多255個字元,嘗試輸入 256個字元,檢查程式能否正確處理 d,輸入預設值,空白,空格 e,若只允許輸入字母,嘗試輸入數字 反之 嘗試輸入字母 f,利用...