![]() |
|
||||||||||
|
|||||
|
Для того чтобы в моем ItemRenderer-e (extend TextArea) при переход на следующую строку DataGrid не переходил на строку ниже хочу отпревентить KeyDownEvent в датагриде, при нажатии клавиши Enter (keycode=13)
package ed
{
import mx.controls.DataGrid;
import flash.events.KeyboardEvent;
public class EDataGrid extends DataGrid
{
public function EDataGrid()
{
super();
this.addEventListener(KeyboardEvent.KEY_DOWN, this.keyDownEvent);
}
public function keyDownEvent(event:KeyboardEvent):void
{
if(event.charCode==13)
{
trace("Enter pressed");
event.preventDefault();
}
}
}
}
|
|
|||||
|
Цитата:
|
|
|||||
|
Усе равно не пашет
![]() Добавил трейсы: trace(event.charCode);
if(event.charCode!=13)
{
trace("pressed not enter");
super.keyDownHandler(event)
}
![]() |
|
|||||
|
Уря! Пашет! Добавил в ItemEditor stopImmediatePropagation():
package ed
{
import mx.controls.TextArea;
import flash.events.Event;
import flash.system.fscommand;
import flash.events.KeyboardEvent;
public class EDescription extends TextArea
{
public function EDescription()
{
super();
this.addEventListener("change", this.changeEvent);
}
private function changeEvent(eventObject:Event):void
{
this.height = (this.textHeight <= 48) ? 48 : this.textHeight+6;
this.verticalScrollPosition=0;
}
override protected function keyDownHandler(event:KeyboardEvent):void
{
super.keyDownHandler(event)
if(event.charCode==13)
{
event.stopImmediatePropagation();
}
}
}
}
|
![]() |
![]() |
Часовой пояс GMT +4, время: 00:38. |
|
|
« Предыдущая тема | Следующая тема » |
|
|