Text List Mouse Click Oddity

My Account Screen uses a Text List to display the patient’s transactions. When the user clicks on a line, a window pops up with the available options for that record. Using GetLocalClick to locate the pop up at the level of the clicked line, one of two things happen:

If I click on a line that’s already selected, the location of the popup is perfect. If I click on a different line, the same calculation based on the coordinates of the mouse click put the popup window almost off the screen. It acts as if jumping to a new record alters my ULV and ULH coordinates that defined the click point to some random values.

It does this whether I put the code in the Procedure panel of the Text List or in a procedure called after getting the mouse click coordinates. ULV & ULH might be 200 & 300 when I click the current record, but if I click any other line in the text list, the values are something like 1332 & -2. These incorrect numbers are constant no matter what record I click on.

The code in the Procedure Pane of the Text List:

GetLocalClick ULV, ULH
mousePoint=xytoxy(Point(ULV, ULH), “S”, “F”)
ULV=v(mousePoint)
ULH=h(mousePoint)
message ULV +"; "+ULH

Does anyone have any idea why this might be happening and how to fix it?

I get the same erratic behavior. But I found that if I put your code inside an “if double-click()/endif” block then it appears to work correctly.

Thanks for checking into this issue, Tom. Is this what you meant?
I tried this, among other variations, but it didn’t change anything. BTW, I had left a GetLocalClick in my last post by error. One doesn’t need the xytoxy conversion with the Local variant.

if doubleclick()
GetLocalClick ULV, ULH
mousePoint=Point(ULV, ULH)
ULV=v(mousePoint)
ULH=h(mousePoint)
endif
message ULV +"; "+ULH

Is this what you meant?

It would appear from my many trials that clicking in a Text List does not give accurate Click coordinates - there is something behind the scenes that changes the value or something. I tried the original code on a rectangle on the same form and a text display element on a different form and they work as expected.

I didn’t actually run your code; I just checked to see if I got consistent coordinates in response to a mouse click. When I used double-click(), I did. With this code, the results were consistent:

if doubleclick()
    alertsheet v(info("click"))+" h:"+h(info("click"))
endif

The only odd thing is that the results give seven (or more in some cases) decimal places, an obviously ridiculous level of precision.

Taking the next step, this code consistently opens a dialog with the upper left corner of the dialog where I had double-clicked. I called the code from the Text List formula.

if doubleclick()
    let lvv=round(v(info("click")),1)
    let lvh=round(h(info("click")),1)
    setwindowrectangle rectanglesize(lvv-25,lvh,110,290)
    opendialog "Test","TitleBar","no"
endif

Here is what it looks like when I clicked on the “B” in Breakfast Sausage.

That was a clever solution that got me thinking. Double clicking isn’t in keeping with other places or forms, so I made another couple of tries with different click commands. I found info(“mouse”) works as expected over a Text List where GetClick and GetLocalClick and a couple others did not work there. Thanks for the help.

Here’s the code that worked and brings up the popup in the right place. I’m using global variables in order to pass the values to the procedure and I use the same ones in multiple databases. (The let command only creates local variables):

ULV=round(v(info(“mouse”)),1)
ULH=round(h(info(“mouse”)),1)
Call “.Edit Line Select”

Here’s the final result as the pop up form lines up with the mouse click and selects the proper record. I think this problem can be put to bed:

FYI, you can create global variables with the letglobal statement.