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

Allow pressing Enter to accept file name - p2 #28

Closed
ghost opened this issue Apr 11, 2021 · 1 comment
Closed

Allow pressing Enter to accept file name - p2 #28

ghost opened this issue Apr 11, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Apr 11, 2021

  1. Open File chooser (to SAVE a file)
  2. Click File name text field (note: text field should have focus when dialog first opens)
  3. Type 12.pdf (ensure that the Save button is enabled)
  4. Press Enter

Expected: Full path to 12.pdf is returned to the application and the dialog closes.

Actual: Nothing happens.

@ghost ghost changed the title Allow pressing Enter to accept file name Allow pressing Enter to accept file name - p2 Apr 11, 2021
@ghost ghost added the enhancement New feature or request label Apr 11, 2021
@io7m io7m self-assigned this Apr 29, 2021
io7m added a commit that referenced this issue Apr 29, 2021
This attempts to improve the semantics of the filename field in file
choosers. The old behaviour was essentially to ignore the return key
when typing into the field. The new behaviour is to attempt to select
an item when pressing the return key and, if an item is selected and
the OK button is unlocked, focus is shifted to the OK button. The
user can then press return to confirm the selection.

Affects: #28
io7m added a commit that referenced this issue May 1, 2021
This commit contains a number of fixes. The implementation of file
selection modes [0] worked, but there was an interaction with code
that was written _after_ the PR was written but _before_ the PR
was merged. This change adjusts the behaviour to allow that code to
work properly.

A cancel() method was added to file choosers to allow for closing
them reliably. This is not expected to be useful outside of the test
suite, where ensuring that all file choosers are closed between each
test run is desirable.

This also makes a few adjustments to the test suite to reduce some
fragility.

[0]: #27
Affects: #28
@io7m
Copy link
Owner

io7m commented May 1, 2021

This isn't quite what you asked for, but I believe the implementation is slightly better in terms of predictability: Pressing Return completes the text field, and selects the item in the directory, and then shifts focus to the Open button. Pressing Return a second time will obviously then press the Open button.

The predictability comes from the fact that pressing Return consistently only closes the chooser if the Open button has focus.

@io7m io7m closed this as completed May 1, 2021
io7m added a commit that referenced this issue May 18, 2021
Release: com.io7m.jwheatsheaf 3.0.0

A big thanks to @DaveJarvis for suggestions, bug reports, and some
code contributions!

Change: Add the ability to specify custom strings (Ticket: #7)
Change: Add the ability to confirm file selections (Ticket: #17)
Change: Allow for including ".." in directory listings (Ticket: #23)
Change: Improve "select directly" dialog behaviour (Ticket: #29)
Change: Fix the size formatter (Ticket: #30)
Change: Use the default filesystem by default (Ticket: #21)
Change: Add support for glob-based filters (Ticket: #19)
Change: Improve filename field behaviour (Ticket: #28)
Change: Add an optional home directory button (Ticket: #12)
Change: Enable sorting of directory items (Ticket: #22)
Change: Allow for setting a default file filter (Ticket: #9)
Change: Allow the escape key to close file choosers (Ticket: #14)
Change: Allow for specifying an initial filename in choosers (Ticket: #15)
Change: Allow for specifying custom dialog titles (Ticket: #8)
Change: Make the default filters part of the public API (Ticket: #10)
io7m added a commit that referenced this issue May 18, 2021
Release: com.io7m.jwheatsheaf 3.0.0

A big thanks to @DaveJarvis for suggestions, bug reports, and some
code contributions!

Change: Add the ability to specify custom strings (Ticket: #7)
Change: Add the ability to confirm file selections (Ticket: #17)
Change: Allow for including ".." in directory listings (Ticket: #23)
Change: Improve "select directly" dialog behaviour (Ticket: #29)
Change: Fix the size formatter (Ticket: #30)
Change: Use the default filesystem by default (Ticket: #21)
Change: Add support for glob-based filters (Ticket: #19)
Change: Improve filename field behaviour (Ticket: #28)
Change: Add an optional home directory button (Ticket: #12)
Change: Enable sorting of directory items (Ticket: #22)
Change: Allow for setting a default file filter (Ticket: #9)
Change: Allow the escape key to close file choosers (Ticket: #14)
Change: Allow for specifying an initial filename in choosers (Ticket: #15)
Change: Allow for specifying custom dialog titles (Ticket: #8)
Change: Make the default filters part of the public API (Ticket: #10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant