Page 1 of 1

Support ESC to cancel Copy to a phone

Posted: 2020-01-16, 13:46 UTC
by Slavic
Please add the support of the ESC key to cancel a copy operation to/from external USB device, e.g. smartphone. Currently only [ No ] button in this dialog works, but no ESC key, nor [x] in the top right corner. Using ESC is very traditional, and lack of it here is unexpected and sad.

Re: Support ESC to cancel Copy to a phone

Posted: 2020-01-25, 19:22 UTC
by Slavic
I have done some searches of this dialog, here are the results.

To show the dialog for copy to/from USB device, TC uses the Win32 API function MessageBox(), which is a simple function to show the short message on the screen, by default in the centre of screen (you can notice the difference from "normal" Copy/Move dialog, which is shown in the centre of TC window). As described in MSDN, MessageBox has some parameters, the last of them is uType, which defines the look of message window and its buttons.

It seems that currently TC calls this function with the uType value MB_YESNO, which shows the buttons [ Yes ] and [ No ], but ignores the [ x ] in the top right corner (it is disabled) as well as Esc key. To enable them, need to use any other value of uType which shows the button [ Cancel ], for example, MB_OKCANCEL. In such case, dialog will show the buttons [ OK ] and [ Cancel ] instead, and Esc will work as expected, closing the dialog like Cancel. The dialog's functionality will remain the same, also the button names will be in line with the buttons in other TC dialogs.

Re: Support ESC to cancel Copy to a phone

Posted: 2020-01-27, 06:25 UTC
by MVV
Well, it is not only TC who uses Yes-No logic because it is more human-readable than Ok-Cancel (compare "Do you want to do something? Yes-No" and "You are going to do something. Ok-Cancel"), especially if the only reason of the latter is closing by Esc. And there are more cases in TC when Yes-No dialogs are used (e.g. buttonbar button deletion confirmation).

You can try my tiny NoClose library from this post, it allows closing Yes-No dialogs by Esc, I use it for years and forgot about this annoyance.

Re: Support ESC to cancel Copy to a phone

Posted: 2020-01-27, 17:44 UTC
by Slavic
Thanks for this suggestion, MVV, but no. It should work similarly for everyone, not only for me. Yes, there may be the situations where the buttons Yes and No are really important because a user should answer the question of critical importance, so allowing to simply close this dialog by Esc would not be a good choice. Because of this, MB_YESNO option should exist and work as the API creators made. Of course, cancelling of the file copy to USB device isn't such case, it should look in line with other Copy/Mode TC dialogs, where the buttons [ OK ] and [ Cancel ] are traditionally used and where Esc works as expected.

As a UI tester (in some other projects) I always try to look at UI from the point of ordinary user, where the common default approach and similarity play important role. I try to forget my professional level and sometimes may ask obvious and maybe silly questions, all for the sake of the future end user.

Re: Support ESC to cancel Copy to a phone

Posted: 2020-01-30, 09:03 UTC
by MVV
I understand your point of view but you can't ask every software developer to fix all dialogs, and there is a solution that already works for now. :)
Unfortunately standard Yes-No message boxes don't have any option to close by Esc, though TC may add a hook itself, so it will work for all users.

Re: Support ESC to cancel Copy to a phone

Posted: 2020-01-30, 10:42 UTC
by ghisler(Author)
The problem is that this isn't even Total Commander's dialog - copying from/to virtual folders goes via Copy+Paste, which is a part of Windows itself.