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 PromptDialog #2896

Open
hyuri opened this issue Oct 9, 2024 · 1 comment
Open

Add PromptDialog #2896

hyuri opened this issue Oct 9, 2024 · 1 comment
Labels
enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed.

Comments

@hyuri
Copy link

hyuri commented Oct 9, 2024

What is the problem or limitation you are having?

Toga offers dialogs of a few different types, including an InfoDialog, QuestionDialog, ConfirmDialog, ErrorDialog and more.

But it does not offer a dialog that captures arbitrary user input, like a number or text.

Describe the solution you'd like

Add a new dialog type, PromptDialog, that takes a specific type — like integer, float or string — and captures user input of that type.

Example:
image

The example above shows a custom dialog I made using Window, for my custom debugging toolset. But it would probably be better to have Cancel and Ok buttons like other dialogs.

Describe alternatives you've considered

None

Additional context

No response

@hyuri hyuri added the enhancement New features, or improvements to existing features. label Oct 9, 2024
@freakboy3742
Copy link
Member

Agreed that this is a gap in Toga's API at present. The Login username/password use case is another obvious example of a "simple input" dialog that is currently missing.

The question is around the API to expose.

In the simplest case, we could have a "single text input" dialog, or a "login dialog". This would solve some obvious use cases, but requires us to enumerate all possible input scenarios.

A more complex interpretation would be to define a "forms" API, and allow a dialog to show a form, define validation, and return a dictionary of values. Django's Forms API would be a good example of an API to replicate.

The benefit of a generic "forms" API is that it would let the user focus on the detail of what they want to gather, rather than the specifics of individual widgets. The form API could also be useful for general layout, as well as forming the basis for a "settings" API (#90).

@freakboy3742 freakboy3742 added the not quite right The idea or PR has been reviewed, but more work is needed. label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. not quite right The idea or PR has been reviewed, but more work is needed.
Projects
None yet
Development

No branches or pull requests

2 participants