1

如何在 OpenEdge ABL / Progress 4GL 中找到在浏览器中右键单击的行的行 ID。

4

2 回答 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 回答