AcceleratorList updating after clearing an accelerator

Posted by Norn on Sat 12 Oct 2024 10:21 PM — 2 posts, 4,958 views.

#0
Hi all,

--

TL;DR: Can we please update AcceleratorList when clearing accelerators? Is there any way we can fully clear an accelerator and fully restore default behavior? Thank you.

--

I saw this issue previously on the forums, but it seems to still be cropping up.

It seems like accelerators remain on AcceleratorList() after being cleared.

First, we set an Accelerator with either Accelerator("Ctrl+Q", "say hi") or AcceleratorTo("Ctrl+Q", "say hi", 0), for example.

AcceleratorList() will show:

Key: "Ctrl-Q"
Value: "say hi"

Pressing Ctrl-Q sends the command as expected.

Next, we clear the accelerator using Accelerator("Ctrl+Q", ""), for example.

Now, we press Ctrl-Q, the command is no longer sent - OK.
However, we still see the old key/value pair in AcceleratorList().

Also, it seems like setting the accelerator to "" actually just sets the accelerator to execute an empty command, although I may be mistaken. For example, if you overwrite Ctrl-C and then clear the Accelerator, default (copy) behavior is not restored and it appears to continue to send a blank command.

Any chance we can have a function that will allow us to fully restore behavior?

Thanks for the time.
Australia Forum Administrator #1
Getting the accelerators to work was quite fiddly, because Windows doesn't let you just change one accelerator, you have to copy the lot and modify the copy.

I didn't worry too much about putting things back because, after all, if you change an accelerator then hopefully this is a one-time thing, eg. you want Ctrl+J to do something else than normal and you always want it to do that.

Since I couldn't easily put the old accelerator behaviour back, then clearing the accelerator just involved putting an empty string there.

All of the existing menu actions can be executed by using "DoCommand" so if you wanted to put the original behaviour of Ctrl+Q back you could do this:


AcceleratorTo ('Ctrl+Q' , 'DoCommand ("ExitClient") ' , sendto.script )