如何在OpenEdge ABL/Progress 4GL中找到在浏览器中右键单击的行的行ID [英] How in OpenEdge ABL / Progress 4GL do I find the row id of a row that is right clicked in a broswer

查看:159
本文介绍了如何在OpenEdge ABL/Progress 4GL中找到在浏览器中右键单击的行的行ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How in OpenEdge ABL / Progress 4GL do I find the row id of a row that is right clicked in a browser.

推荐答案

我不确定这是否是您要寻找的东西,但我希望它对某人有用.

I'm not sure if this is what you're looking for, but I hope it will be useful to someone.

我想对浏览器中鼠标的右键单击做出响应.右键单击不会选择您要单击的行,因此我不得不以编程方式找出它所在的行.

I wanted to respond to the mouse's Right-click in a browse. Right-clicking does not select the row you're clicking on, so I had to programatically figure out which row it was.

这出现在浏览器的MOUSE-MENU-DOWN事件中:

This goes in the MOUSE-MENU-DOWN event of the browse:

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.

我希望这会有所帮助.

这篇关于如何在OpenEdge ABL/Progress 4GL中找到在浏览器中右键单击的行的行ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆