home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------------------
- // Object Scripting
- // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
- //
- // KEYASSGN.SPP: Key Assignments. Shows what commands are assigned to a
- // given key sequence.
- //
- // USE: Run script, and enter the key sequence.
- //--------------------------------------------------------------------------
- print typeid(module());
-
- //
- // IDE imports.
- //
- import IDE;
-
- keyassgn()
- {
- // Get the keys.
- //
- declare keys;
- keys = IDE.KeyPressDialog("Enter the key sequence to check", NULL);
-
- if (keys) {
- // Create a top-level message for the key sequence.
- //
- declare parent;
- parent = IDE.MessageCreate("Keyassgn", NULL, INFORMATION, 0,
- "Commands assigned to " + keys, NULL,
- NULL, NULL, NULL, NULL);
-
- // Check each subsystem keyboard.
- //
- CheckKbd("Editor", parent, keys);
- CheckKbd("ClassExpert", parent, keys);
- CheckKbd("Message", parent, keys);
- CheckKbd("Project", parent, keys);
- CheckKbd("Browser", parent, keys);
- CheckKbd("Desktop", parent, keys);
- CheckKbd("Default", parent, keys);
-
- // Show results.
- //
- IDE.ViewMessage("Keyassgn");
- }
- }
-
- //
- // Checks a keyboard for assigned command, and reports command if found.
- //
- CheckKbd(subSystem, parentMsg, keys)
- {
- declare kbd = IDE.KeyboardManager.GetKeyboard(subSystem);
- declare cmd = kbd.GetCommand(keys);
-
- if (cmd) {
- IDE.MessageCreate("Keyassgn", NULL, INFORMATION, parentMsg, NULL, NULL,
- NULL, subSystem + " -> " + cmd, NULL, NULL);
- }
- }
-
-