How shortcut string is created in a menu? - winapi

In a menu shortcut, for example: "New Ctrl+N", is the space between "New" and "Ctrl+N" created using a simple '\t' or there is a special function that takes a shortcut string and add it to the menu string?

It's \t:
Text that identifies the shortcut key is added to the menu-item text string. The shortcut text appears to the right of the menu item name, after a backslash and tab character (\t). For example, "&Close\tAlt+F4" represents a Close command with the ALT+F4 key combination as its shortcut key and with the letter "C" as its access key. For more information, see Keyboard Accelerators.

Related

How to define the shortcut for selecting to the beginning of line

When I at the end of line.
I can use a shortcut to select to the beginning of line.
There is a shortcut. If the system-wide shortcut
⌘← moves the cursor to the beginning of the line and
⇧← extends the selection it's logically
⇧⌘←
To discover the shortcuts open the preferences of Xcode > Key Bindings and type something in the search field for example beginning

How can I put 0x08 ascii character using MacBook?

I'm writing this question because one little invisible problem has taken from me hours and hours of dummy searchings, and the time just has been wasted (here is that question: CSS: Is there any difference between these two parts?)
Does anybody know how the character 0x08 ("backspace" in ASCII) can be written into a text using a MacBook and a simple IDE (I use the "Coda")?
There is no ability to press Alt + 08 on MacBook (there is no digital keys part on the MacBook's keyboard).
How it can happen?
Did you copy & paste it from anywhere? Because the only way I know - apart from what SCFrench suggested - is to enable this in Terminal by typing:
stty erase SPACE CTRL+V CTRL+H RETURN
Not sure if this is the easiest way, but:
In the Keyboard system preferences panel, check "Show Keyboard & Character Viewer in menu bar".
Find the Keyboard menu bar icon (on the right side of the menu bar), click it, and select "Show Character Viewer".
In the Characters window that appears, find the "View" pop up menu and select "Code Tables".
Select the Unicode coding tab.
In the middle section where all the characters are displayed, click on the entry for 0008 (it will be blank, but the Name: field will say "BACKSPACE").
Click the Insert button in the same window.
Since the character is non-printable, it doesn't actually show anything in the text editor, but (at least in TextEdit) you will see that you have to hit the left or right arrow key more than once to move past it. I also confirmed by dumping the file in hex that it contains a 08 byte.
You could also use this technique to set up a Text Substitution in the Text tab of the Language & Text system preference panel.
Shift + Up Arrow + Delete/Backspace. It's a bug.
http://www.openradar.me/5288750

Textmate-like Keyboard Navigation for the Command Line?

How do I better navigate the command line? In TextMate, I can do:
CMD + ALT + ARROW to switch tabs
CMD + SHIFT + ARROW to highlight lines of text
ALT + SHIFT + ARROW to highlight words
ALT + ARROW to jump words, etc.
How do I do this kind of stuff in the terminal?
Here's a slightly more complete mapping from Mac text navigation to the default Readline keys:
I set this up in the Keys pane of my iTerm2 preferences, but you should be able to make the same mappings in Terminal.app (Edit: Everything except the first two. Terminal.app only lets you pick from a few different keys)
In MacOS' Terminal app, you can change your keyboard bindings; go to Terminal Preferences (shortcut Cmd + ,) and navigate to the 'Keyboard' tab:
Key => Action
control cursor left => \033b
control cursor right => \033f
etc. You can do the same thing with other emacs-style bindings. As far as switching tabs, that's a System Preferences > Keyboard > Keyboard Shortcuts setting; click 'Application Shortcuts' on the left side, and then click + on the right to add a new shortcut. Use your desired keyboard combo and pair it with the exact menu name, which in Terminal for moving forward/backward through tabs is 'Select Next Tab' and 'Select Previous Tab' (via the Window menu in Terminal), respectively.
Does that help?
This is a pointer for anyone landing here looking for the equivalent tips for iTerm (as opposed to the default terminal).
To do the same in iTerm, go to menu "Bookmarks", "Manage Profiles", "Keyboard profiles", "Global".
Then add all of the shortcuts you see in the other answers here, but instead of sending text "\033..." when creating a mapping, you simply select the action "send character sequence" and the character for the escape sequence!.
"\033b" becomes b
"\033f" becomes f
and so on.
Escape sequence example
Some things can be done by editing the readline bindings (see bind -p / man bash) but for some of the mac keyboard keys you can (or need to?) set extras up in Terminal.app's preferences.
For word navigation try this:
Terminal preferences -> settings -> keyboard
add the following:
option cursor left \033b (escape b) (backwards word)
option cursor right \033f (escape f) (forward word)
option forward delete \033d (escape d) (kill word)
Word boundaries behave a little differently, but it's better than single character or whole line navigation, and doesn't require trading your option key for a meta key and learning a bunch of new key combos.

Shortcut for Replace button in "Find and Replace" dialog

I call up Find and Replace dialog with Ctrl+H. On F3 it finds the result but then I must hunt the Replace button using the mouse. And on every new find, it changes the screen position. Is there any way to use this dialog using only keyboard?
It will save me a few precious seconds multiplied by some very large number (I'm in the middle of heavy refactoring).
In visual studio 2015:
Ctrl+H opens the Replace dialog.
Ctrl+F opens the Find dialog.
Within that dialog:
Alt+N - Focus "Find" entry field
Alt+P - Focus "Replace with" entry field
Alt+C - Toggle Match Case
Alt+W - Toggle Whole Word
Alt+E - Toggle Regular Expressions
Alt+L - Open "Look In" dropdown list. Use Up/Down and Enter to select from this list:
Current Block
Selection
Current Document
All Open Documents
Current Project
Current Solution
Alt+R - Replace Next
Alt+A - Replace All
Esc - Dismiss dialog
For example, to replace "foo" with "bar" within the current selection:
Ctrl+H - Opens the Replace dialog, with focus on "Search Term".
Enter "foo"
Alt+P - Focus is now on "Replacement Term"
Enter "bar"
Alt+L, choose "Selection", press Enter.
Alt+W - Whole word only
Alt+R - Replace first term
Esc - Close replace dialog.
Sorry,
As microsoft there is no keyboard shortcut as Replace Next,
You can check this url
http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx
You could simply copy your desired replacement text before starting to F3 through your source text, and hit Ctrl+V when you hit the next match as VS selects the match text for you.
It is a hack, but it works.
If you dock the find/replace window then it will not move with each new find.
You can then alternate with 1 finger on F3 to move to next find, while hovering the mouse over the non-moving replace button to replace what you need.
It is possible to deactivate Resharper default behavior of "Alt+R" which provides a quick access to Resharper menu in Visual Studio.
Just uncheck it in Resharpers options:
enter image description here

How do you do the "therefore" (∴) symbol on a Mac or in Textmate?

Is there a way to write the ∴ therefore symbol with keyboard shortcuts in Textmate or just on a mac?
If you want to do this often, you can create a keybindings file in your Library to map it to a key combination.
In ~/Library create a directory named KeyBindings. Create a file named DefaultKeyBinding.dict inside the directory. You can add key bindings in this format:
{
"x" = (insertText:, "\U23CF");
"y" = (insertText:, "hi"); /* warning: this will change 'y' to 'hi'! */
}
The LHS is the key combination you'll hit to enter the character. You can use the following characters to indicate command keys:
# - Command
~ - Option
^ - Control
You'll need to look up the unicode for your character (in this case, ∴ is \U2234). So to type this character whenever you typed Control-M, you'd use
"^m" = (insertText:, "\U2234");
You can find more information here: http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html
First you use a full stop, then you hold down alt and press the letter H and put in another full stop.
.˙.
From System Preferences, turn on the "Show Keyboard & Character Viewer in menu bar" setting.
Then, the "Character Viewer" menu will pop up a tool that will let you search for any unicode character (by name) and insert it ∴ you're all set.
If using WORD for mac
enable 'use maths autocorrect rules outside maths regions'
Type \therefore
If you are trying to insert the therefore symbol into a WORD DOCUMENT
Hold down the ALT key and type 8756
Hope the answer ur question
Regards Al~Hash.

Resources