Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KeyboardModifiers to PointerEvent / Add PointerEvent to clicked closure #2686

Closed
wspl opened this issue May 4, 2023 · 2 comments · Fixed by #3045
Closed

Add KeyboardModifiers to PointerEvent / Add PointerEvent to clicked closure #2686

wspl opened this issue May 4, 2023 · 2 comments · Fixed by #3045

Comments

@wspl
Copy link

wspl commented May 4, 2023

I'm creating a List with a multiple selection feature. I need to detect whether the user pressed Shift or Control when clicking, in order to decide which selection operation to perform.

I tried wrapping my window with FocusScope to capture keyboard events. However, it is behaving strangely: It doesn't get focused when I click a list item directly. I need to click the blank area of the window to make it focus, which then allows FocusScope to capture the keys.

I think a better approach to make it work would be to add KeyboardModifiers to PointerEvent. And then expose the PointerEvent struct to the clicked closure. (The pointer-event closure is unstable too, it doesn't triggered in many situaion. Perhaps I will open a new issue to describe this problem.)

@wspl wspl changed the title Add KeyboardModifiers to PointerEvent / Add PointerEvent to clicked closure Add KeyboardModifiers to PointerEvent / Add PointerEvent to clicked closure May 4, 2023
@ogoffart
Copy link
Member

ogoffart commented May 4, 2023

Yes, we should have a way to detect the keyboard modifier.

This was also discussed in #1280

As a workaround for now, see the example in #2641 (comment)

@ogoffart
Copy link
Member

ogoffart commented Jul 5, 2023

(this was asked for again in #3043 )

ogoffart added a commit that referenced this issue Jul 5, 2023
ogoffart added a commit that referenced this issue Jul 5, 2023
ogoffart added a commit that referenced this issue Jul 6, 2023
* Add modifiers to PointerEvent

Closes #2686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants