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

Spinner widget, event stealing, async "loading screen", Widget trait doc #319

Merged
merged 18 commits into from
May 13, 2022

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented May 13, 2022

Adds a Spinner widget. Also, spot the new theme colour buttons in the Gallery. (This is with 150% scale factor.)
spinner

The usual controls are implemented:

  • Text editing (immediate change in background on error, but only updates value on focus lost or Return key)
  • Up/down arrow, mouse scroll
  • Buttons on right, which are not keyboard-navigable but which do highlight on hover (though this is not very clear, depending on the theme colour)

To implement up/down and mouse-scroll event handling I added a new method to Widget:

/// Potentially steal an event before it reaches a child
fn steal_event(&mut self, mgr: &mut EventMgr, id: &WidgetId, event: &Event) -> Response;

This is functionality which was lost when SendEvent::send was removed; at the time there was not a good rationale for keeping it, but this widget does provide one: the ability to use a complex inner widget like EditBox (~1100 lines of code), but customise handling of specific events.

Documentation of the Widget trait (and co) was improved.

Additionally, the async-event example now shows a "loading..." message for 1s before async event handling starts. This is just a hint to show that this kind of thing is possible; a larger example might use the Stack widget to switch between the loading message and finished view (or just disable content and use a Progress mouse cursor).

@dhardy dhardy merged commit e922148 into master May 13, 2022
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 this pull request may close these issues.

1 participant