Re: FXList, FXTreeList and getCursorItem

[email protected] Wed, 14 Jun 2023 07:35:56 -0500
Newsgroups gmane.comp.lib.fox-toolkit.user
Message-ID <[email protected]>
On 2023-06-13 15:12, Enno Rehling wrote:
> Hi,
> 
> I have an application using Fox 1.6 that I build on Windows and Linux,
> and some Linux users have reported that context menus on TreeList
> items no longer work. I cannot reproduce this on Windows, and not on
> my Ubuntu machine, but it happens on a Debian bullseye installation.
> What's happening is this:
> 
> I handle the SEL_RIGHTBUTTONRELEASE message and create a FXMenuPane
> for the popup based on the value of getCursorItem, but on this
> machine, that always seems to return null. As a fallback, I can call
> getItemAt(event->click_x, event->click_y) and that also returns the
> item I'm looking for, but
> 
> a) this feels like it shouldn't be necessary, and
> b) how is it only broken on this one distro?
> 
> A similar thing happens in another part of the application with an
> FXList, for which getCursorItem consistently returns -1.
> 
> Interestingly, if I run the program so that it sends the display to
> another X server, then getCursorItem works, so could it be a bug in
> xserver-xorg? The one in bullseye is significantly older than the one
> in jammy.

You found the reason that getCursorItem() was removed in newer versions
of FOX:- it was not very reliable as it is possible for cursor to move
over the widget w/o reporting mouse events.

At least two causes:

1) A grab was released, and the cursor happened to be in the widget.
    This means an enter event is received, but no move event. The
    cursor item would be reset to null

2) Widget is disabled.  It will not handle mouse events, and the
    cursor item will not reflect the item under the cursor.


Using the getItemAt() is more future-proof and should always work, if 
there
are any items actually under the cursor.


Regards,
                -- JVZ