[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Accelerator tricks

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Accelerator tricks

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Larkin   (278 posts)  [Biography] bio
Date Mon 31 Jan 2011 08:12 PM (UTC)  quote  ]
Message
I'm trying to set up my keypad to change commands based on certain things, and then I want to delete the accelerators or revert them to what they were before. This seems especially tricky, so I'm wondering if I'm missing something here. Keep in mind that this script will be used by others, and I want to keep it general enough to play nice with whatever accelerators they have configured.

1. I have my keypad configured in the Configuration -> Input -> Keypad, but those are not real accelerators. They don't show in AcceleratorList, so I don't know how to grab the commands and save them to be restored later.

2. There seems to be no way to delete an accelerator, such as setting it to nil, and when I use an empty string, it doesn't do anything, though the documentation says it will revert to what it was previously (how does it know?).

3. I have to loop on all the accelerators to get the value for any one macro? Why no lookup table functionality?

I know I can hardcode the keypad accelerators to what I want, but I'm trying to be efficient and user friendly, so any advice?

Thanks.
[Go to top] top

Posted by Nick Gammon   Australia  (18,800 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 31 Jan 2011 09:01 PM (UTC)  quote  ]
Message

  1. You can find current keypad values with ExportXML. The names to enter to this function will be the ones which appear in the world file XML. Also see table "strKeypadNames" in prefspropertypages.cpp as described below.

  2. Doing what the documentation says removes the "special" accelerator, returning the function of that key to what it originally did. So the simple case would be just to use AcceleratorList to find what ones you added, and just set those ones back to an empty string. If you think this doesn't work can you produce a test case?

  3. The macros are predefined (see the world file). The list will never infrequently change. The actual names are in the source here:

    https://github.com/nickgammon/mushclient/blob/master/dialogs/world_prefs/prefspropertypages.cpp

    Currently around line 1929, or search for "strMacroDescriptions".



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #2 on Mon 31 Jan 2011 09:11 PM (UTC)  quote  ]
Message
Larkin said:
1. I have my keypad configured in the Configuration -> Input -> Keypad, but those are not real accelerators. They don't show in AcceleratorList, so I don't know how to grab the commands and save them to be restored later.

I believe you can use ExportXML(5, "") to get the keypad settings as XML. Then if you're using Lua you can use utils.xmlread() to turn it into a nested Lua table. It should be reasonably easy to turn that back into XML and pass it to ImportXML().

Larkin said:
2. There seems to be no way to delete an accelerator, such as setting it to nil, and when I use an empty string, it doesn't do anything, though the documentation says it will revert to what it was previously (how does it know?).

"what it was previously" likely refers to the keybinding's default, if any. For example, Ctrl+C's default is to copy, and Ctrl+S saves the world.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,135 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]