Perhaps an easier and more direct solution for this would be to move your context menu to the cursor’s location, like,
Move MyContextMenu to ([[Cursor.x]], [[Cursor.y]])
So the item’s location is not being calculated properly. I think in my sample expression above I assumed the entire row would be clickable, rather than a specific widget within that row. To accommodate the latter, as well as the x-coordinate, a more full expression would look like:
Move MyContextMenu to ( [[LVAR1.x + This.x]],
[[LVAR1.y + ((LVAR2.height * (Item.index -1)) + This.bottom)]] )
- Where LVAR1 is a local variable pointing to the repeater widget
LVAR2 is a local variable pointing to a widget which is the full height of the row
This is a built-in pointer to the widget triggering this event–the widget being clicked.
- (All rows need to be the same height)
Here’s some background on how the method I describe above works–for a context menu separate from the repeater. Within a repeater cell (the widgets in each row) all coordinates are relative to that row’s cell, not relative to the page. So, to get the location of a widget in a row in a repeater, you need to:
- Start with the location of the repeater (these are the
- Then, calculate the row’s location in the repeater (the y-coordinate for vertical repeaters, the x-location for horizontal repeaters)–assuming all row’s have the same dimensions, you get this value with the expression,
LVAR2.height * Item.index , where LVAR2 is a widget equivalent to the height of each row.
- (Alternatively, you could refer to the bottom of the bottom-most widget in the row cell with
- To get the top of each row, subtract 1 from Item.index before multiplying.
- Then, calculate the widget’s coordinates within the row, using “This” as a relative pointer–assuming the positioning is relative to the widget which is clicked.
- Likewise, the coordinates of widgets within a dynamic panel are relative to that dynamic panel. So, if your repeater is located inside a dynamic panel, you’ll need to start with the location of that dynamic panel (and so on if dynamic panel is nested within another dynamic panel), then add the location of the repeater, then location of the row, then location of a widget within the row.
Are all your rows the same height?
- If not, the y-axis (vertical) location would be wrong–maybe for all but the first row.
- You’d need a way to accommodate for each row’s height. This could be tricky if they are all different in unpredictable ways. Perhaps each row could calculate it’s own height in the Item Loaded event and store the cumulative result in a variable and/or hidden text widget in the repeater cell.
If you have a sample .rp file you could post, I could take a look and offer a tailored solution for you.