OpenEdge ABL / Progress 4GLで、ブラウザで右クリックされた行の行IDを見つけるにはどうすればよいですか。
2943 次
2 に答える
0
「FOCUSED-ROW」属性を探していると思います。
于 2012-01-20T15:53:43.020 に答える
0
これがあなたが探しているものかどうかはわかりませんが、誰かに役立つことを願っています。
ブラウズでマウスの右クリックに応答したかった。右クリックしてもクリックしている行が選択されないため、プログラムでそれがどの行であるかを把握する必要がありました。
これは、ブラウズのMOUSE-MENU-DOWNイベントに含まれます。
DEFINE VARIABLE iRowHeight AS INTEGER NO-UNDO.
DEFINE VARIABLE iLastY AS INTEGER NO-UNDO.
DEFINE VARIABLE iRow AS INTEGER NO-UNDO.
DEFINE VARIABLE hCell AS HANDLE NO-UNDO.
DEFINE VARIABLE iTopRowY AS INTEGER NO-UNDO.
/* See if there are ANY rows in view... */
IF SELF:NUM-ITERATIONS = 0 THEN
DO:
/* No rows, the user clicked on an empty browse widget */
RETURN NO-APPLY.
END.
/* We don't know which row was clicked on, we have to calculate it from the mouse coordinates and the row heights. No really. */
SELF:SELECT-ROW(1). /* Select the first row so we can get the first cell. */
hCell = SELF:FIRST-COLUMN. /* Get the first cell so we can get the Y coord of the first row, and the height of cells. */
iTopRowY = hCell:Y - 1. /* The Y coord of the top of the top row relative to the browse widget. Had to subtract 1 pixel to get it accurate. */
iRowHeight = hCell:HEIGHT-PIXELS. /* SELF:ROW-HEIGHT-PIXELS is not the same as hCell:HEIGHT-PIXELS for some reason */
iLastY = LAST-EVENT:Y. /* The Y position of the mouse event (relative to the browse widget) */
/* calculate which row was clicked. Truncate so that it doesn't round clicks past the middle of the row up to the next row. */
iRow = 1 + TRUNCATE((iLastY - iTopRowY) / iRowHeight, 0).
IF iRow > 0 AND iRow <= SELF:NUM-ITERATIONS THEN
DO:
/* The user clicked on a populated row */
Your coding here, for example:
SELF:SELECT-ROW(iRow).
END.
ELSE DO:
/* The click was on an empty row. */
SELF:DESELECT-ROWS().
RETURN NO-APPLY.
END.
これがお役に立てば幸いです。
于 2012-02-07T10:51:34.963 に答える