Detect a merge field under cursor

  • I have manage to make mergefields not editable and non erasable. The user can modify the document but not the merge fields.

    Now, I need a way to allow the user to click on a merge field (anywhere on the field) and display a popup. Right now, I get this behaviour only if the user clicks at the beginning of the merge field...

    Is there a way to detect the mouse is on top of a merge field? I have tried a number of things w/o any luck.

    I am thinking something along this lines (this code does not work)