Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I already answered this question here : <a href="https://stackoverflow.com/questions/8943704/how-in-openedge-abl-progress-4gl-do-i-find-the-row-id-of-a-row-that-is-right-c/9174933#9174933">How in OpenEdge ABL / Progress 4GL do I find the row id of a row that is right clicked in a browser.</a></p> <p>I'm not sure what the policy is with this duplicate question, but I'm repeating my answer here, I hope it's OK.</p> <p>I had a similar situation; 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 programmatically figure out which row it was. The coding below determines which row you clicked on and selects it. I am afraid it really is this complicated. </p> <p>This goes in the MOUSE-MENU-DOWN event of the browse: </p> <pre><code>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 &gt; 0 AND iRow &lt;= 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. </code></pre> <p>I hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload