質問の意図とは外れるかもしれませんが・・・
RecordGrid では、レコードセレクタ上の
Enter キー押下のイベントが KeyPress ではなく
Action に置き換わってしまいますが、
GuiManager クラスを使うことで回避は可能です。
意図したイベントが置き換わってしまい、ハンドリングできないときの
手段として、自分は使っていました。
以下はグリットのレコードセレクタ上でのダブルクリックと
エンターを区別させたい場合のサンプルです。
Code:
{define-enum public event-type
KeyPress,
PointerPress
}
{let press-type:event-type = event-type.KeyPress}
{let gm:GuiManager = {get-gui-manager}}
{gm.add-event-handler
{on e:Event at an:any do
{type-switch e
case rkp:RawKeyPress do
set press-type = event-type.KeyPress
case pp:PointerPress do
set press-type = event-type.PointerPress
}}}
{define-class public GridDoubleClick {inherits Event}
{constructor public {default}}
}
{define-class public GridEnter {inherits Event}
{constructor public {default}}
}
{define-class public CustomRecordGrid {inherits RecordGrid}
let public ge:GridDoubleClick = {GridDoubleClick.default}
let public ge2:GridEnter = {GridEnter.default}
field private _my-event:EventHandler = {on e:Action at grid:RecordGrid do
{if grid.current-index >= 0 then
{if event-type.PointerPress == press-type then
{grid.enqueue-event CustomRecordGrid.ge}
elseif event-type.KeyPress == press-type then
{grid.enqueue-event CustomRecordGrid.ge2}
}
}
}
{constructor public {default ...}
{construct-super ...}
{self.add-event-handler
self._my-event}
}
}
{let people:RecordSet =
{RecordSet
{RecordFields
{RecordField
"First", caption = "First Name", domain = String
},
{RecordField
"Last", caption = "Last Name", domain = String
},
{RecordField "Age", domain = int}
},
{RecordData First = "John", Last = "Smith", Age = 25},
{RecordData First = "Jane", Last = "Smith", Age = 29},
{RecordData First = "Jane", Last = "Jones", Age = 28}
}
}
{CustomRecordGrid
record-source = people,
height = 3cm,
{on GridEnter do
{popup-message "GridEnter!"}
},
{on GridDoubleClick do
{popup-message "GridDoubleClick!"}
}
}