Skip to content

Improve flexibility of PaneGrid #608

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

Merged
merged 6 commits into from
Nov 10, 2020
Merged

Improve flexibility of PaneGrid #608

merged 6 commits into from
Nov 10, 2020

Conversation

hecrj
Copy link
Member

@hecrj hecrj commented Nov 10, 2020

The current PaneGrid widget implicitly manages and exposes pane focus state without producing application messages.

This is generally forbidden. Meaningful application state changes that can trigger differences in the widget tree should always happen as a result of message processing and its respective call to Application::update.

After merging #597, this design flaw has become very apparent and the pane_grid example does not work as expected anymore.

This PR fixes the design of the PaneGrid widget while, at the same time, simplifying its API and making it more flexible overall. Specifically:

  • The built-in focus handling is completely gone. A PaneGrid does not know about any kind of pane focus.
  • A new on_click event handler has been added to PaneGrid. This handler can be used to reproduce and extend the old focus functionality on top of application code.
  • The on_key_press handler has been removed. Instead, it is recommended to use subscription::events or the brand new subscription::events_with in order to listen to keyboard events.

As usual, the pane_grid example has been updated to showcase how to use this new API. It should reproduce the old behavior (prior to merging #597).

- Implement `subscription::events_with`
- Remove `pane_grid::KeyPressEvent`
- Return closest sibling in `pane_grid::State::close`
@hecrj hecrj added the feature New feature or request label Nov 10, 2020
@hecrj hecrj added this to the 0.2.0 milestone Nov 10, 2020
@hecrj hecrj self-assigned this Nov 10, 2020
@hecrj hecrj merged commit 2f5a3da into master Nov 10, 2020
@hecrj hecrj deleted the remove-pane-grid-focus branch November 10, 2020 21:57
hecrj added a commit that referenced this pull request Nov 17, 2020
Since #608, the `PaneGrid` widget does not handle pane focus.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants