I would like to know if it is possible to create a custom keyboard shortcut in CF Builder 2 and have selected text retained and placed within the code of the inserted text. Sort of like a custom wrap.
Not quite, but you can create snippets and bind them to some trigger text. Matt Gifford's article on snippets is more useful than the official documentation.
Related
Could anyone point me in the right direction here? I am adding a custom toolbar and I want buttons for lots of different code snippets. We use so many that it is impracticable to remember all the different shortcut commands for each one, and selecting from a menu takes longer than just clicking a button.
It doesn't really even need to be specifically for a code snippet as defined by Visual studio, just simply pasting some text to the editor window, however I was hoping to be able to have some that would work as surround snippets, which the normal code snippets do.
You should call this:
(DTE2)base.GetService(typeof(DTE))
in the Initialize() method of the Package and save the resulting dte-instance in a field. When your button is clicked, you can use ((TextDocument)_DTE.ActiveDocument).Selection.Text) to retrieve the currently selected text, modify it and write it back as new selected text. Maybe you will have to cast the return value of the Selection-Property to TextSelection.
While developing an application, I am asked to remove multi-line text inputs from NSTextField - Which I did.
Again they said users are able to paste multiline texts, then I disabled ⌘+V.
From here...
I have a confusion... Why NSTextField allows opt + Enter and other key shortcuts (like hacking) to insert a new line character. I read somewhere that it is a feature not a bug, but I am unable to find that link.
Is the above correct, and is it mentioned any where in Apple Documentation?
This behavior is documented (or at least mentioned as a feature of NSTextField) here in the Mac developer library: https://developer.apple.com/library/mac/qa/qa1454/_index.html
Here's another doc reference: Working with the Field Editor. Specifically, it says "Users can easily put newline characters into a text field by pressing Option-Return or Option-Enter."
in my application I used a Textbox with input scope "text". When I type in Textbox, I can see a suggestion bar above the keyboard which contains some words.If I type a in Textbox I can see the words "and","are","at"...etc.I want to customize these words.
for example if I type "a" I want to show the names "alan","alex"..etc.
Is there any way to change this?
Please help me
Is there anyway to customize the words appearing in the auto complete suggestion bar for text input scope in
You also can't do anything AT ALL with the keyboard. If this is for a custom app, perhaps a list would work such as the list in the people hub for example. Pretty sure MS isn't releasing any keyboard API's for WP8 either, so the only alternative is a workaround or alternate method.
There is no way to control text suggestions in the auto-complete bar. You are only able to choose type of input scope and no more.
It'd be really handy to have collection KVC accessor snippets in xcode, as they're a pain to do by hand. Has anyone who's been using 4 for a while worked out how to add new ones?
(...we're allowed to talk about it now, right?)
Yes, it's quite easy - you just highlight text you want to use as a snippet and drag it into the snippets area (dragging selected text can be difficult, I find it works better if you drag from the left edge of the editor). It brings up a dialog box asking you to name it.
Also, you can have custom parameters in snippets - if you put the text <#paramName#> anywhere in the code you are dragging, when you use the snippet it will come up as a replaceable parameter that you can tab between just like in the official Snippets.
Also make sure to set a completion prefix, which makes it shorter to activate the snippet as you are typing. The nice thing about using Snippets over other solutions like global system text expanders, is that snippets can also be limited to being valid in a certain area of code - so for example a snippet that filled out a string formatting line can be marked as valid only within a block, not outside a method. That way the completion prefix only hits in areas where it's valid to use.
You can edit a snippet by clicking once on it, a box will come up with the snippet text and some other snippet settings you can edit.
A tip to help you drag the code every time, select text then click + hold (do not move mouse) until mouse pointer changes from "I" to pointer. You'll then be able to drag the selected text to the Code Snippet Library.
Drag the highlighted code to the Snippet library. (It can be stubborn and not want to drag. Holding the mouse button down for a moment before dragging seems to help.)
You can use Snippets to manage code snippets in Xcode. Check out this demo http://www.youtube.com/watch?v=il4kE4diy0k
Simply select the code, the press ALT key and drag it into the code snippets library and rename it there, Make sure to press the ALT key, other than this you won'n be able to drag it.
I want to create a simple extension which modifies text buffers based on a command. No sample, documentation or template that I've found so far explains anything about working with text buffers. Anyone got a clue how to do this?
What I want to end up with is a format selection/document extension for text files, that wrap content around 72 characters per line.
I found this extension together with sample very helpful, and now I have something which works. Though it was very counter intuitive at first, I was trying to get the at the code window while this example instead uses a command filter to fiddle with the text view by extending the editor.
The ITextView interface provides access to the text in the editor, you can access the Buffer through that and make changes that way.
Link
http://github.com/noahric/alignassignments