It seems that after more digging this issue gets created after i put the listbox into a window and the window has some custom code in it it takes as well the formatting of the window related to the selection color and so, ill try to make a sample project and if still shows there ill put it here and even open a feedback case to see if it`s ListBox related or some other issues.
im doing that now, the project is based on SamNSPopover so im doing now tests to see if there is the problem, once i discover the issue i`ll post it here with the sample project.
Here is a project demo that has the issue . I`m guessing as well that is something related to the NSPopup inheritance as i see that it overrides the select color and as well this select issue.
I saw the problem in both the current Xojo and Xojo 2013 R3.
Actually it is not exactly a row difference as when you click in about the bottom 15% of a row that row gets selected.
Moving the Listbox up or down has no effect on the problem, or in other words displays the same problem.
Changing the default row height of the listbox however does have an effect (try setting it to 30, then about 50% of the row selects the right row) though the problem is still there.
[quote=246522:@Markus Winter]Checkboxes or Radiobuttons on the Popup don’t show that behaviour.
Wether Listbox has heading or not makes no difference.
Seems to be a problem with the Listbox[/quote]
Well indeed but it seems that it is related to that NSPopover part , as if you take a listbox and put it on a window it works ok, when you have it in that setup does not work. More digging, hope that i`ll find the issue soon.
Well it seems that on the project that Bill did with this NSPopover it works ok but the Popover is messed up even in the settings it is set to hide all the controls it is still showing them on the tests. so i guess it is related to the code in the project part.
This problem is driving me crazy too. Only on Mac, no problem on Windows and Linux.
If the row is visible the click returns the correct row.
If the user scrolls down and clicks on a row that was previously not visible, the listbox returns the wrong row.
(Actually I think it returns the row that had the X,Y co-ordinates before the scroll)
It has to be the first click in the listbox ie. open the program, scroll and click. After that it works fine.
[quote=246508:@Aurelian Negrea]Here is a project demo that has the issue . I`m guessing as well that is something related to the NSPopup inheritance as i see that it overrides the select color and as well this select issue.
Thanks .[/quote]
Here is a workaround for the listbox selection, together with a possible way to compensate for other events or get the cell clicked (second line in MouseUp) :
Function MouseDown(x As Integer, y As Integer) As Boolean
return true
End Function
Sub MouseUp(x As Integer, y As Integer)
me.selected(me.RowFromXY(x,y)) = False
me.selected(me.RowFromXY(x,y+me.RowHeight)) = True
End Sub
[quote=248577:@Craig Grech]This problem is driving me crazy too. Only on Mac, no problem on Windows and Linux.
If the row is visible the click returns the correct row.
If the user scrolls down and clicks on a row that was previously not visible, the listbox returns the wrong row.
(Actually I think it returns the row that had the X,Y co-ordinates before the scroll)
It has to be the first click in the listbox ie. open the program, scroll and click. After that it works fine.[/quote]
NSPopover does not exist in Windows and Linux.
If your ListBox is not laying on a Popover, your issue may not be related at all.