Protect a range of text in ScintillaNet: what is the best way to do it? - scintilla

I know that styles have an attribute to allow/avoid changes in the text in which they are applied:
SCI_STYLESETCHANGEABLE(int style, bool changeable)
However, the documentation says "This is an experimental and incompletely implemented style attribute.", which seems it is not "production-ready"
I think there is another alternative, using "Indicators":
To protect a range of text, we could apply an specific indicator to it and in keydown event detect "del" & "backspace". If the character that follows current position (caret position) in "del" case or that precedes current position in "backspace" case has this indicator, then we must cancel the event and do not erase the text.
Which of this 2 alternatives is better? There is another better way?
Note: ScintillaNet is based on Scintilla and I assume that the extensive documentation of the last one is valid for both.

I share with you one of the responses in "scintilla-interest" google-groups that published Neil Hodgson, the creator of Scintilla.
[Ian G.]> SCI_STYLESETCHANGEABLE is what I tried initially before I resorted to writing this patch. The only real disadvantage I can see is that in cases like my own it doubles the number of styles needed because every visual style that can occur in a writeable region can also occur in a protected region, but I could live with that.
[Neil Hodgson] It would be better to use an indicator for protected areas since they are relatively space efficient and avoid doubling the number of styles.
complete post in scintilla-interest

Related

Do I need to use aria-label on elements that have visible labels which are read by screen reader?

My company is trying to become WCAG compliant. One of the things we need to do is add aria-label to interactive elements. My question is do I need to add an aria-label to an element which already has a label which is read by a screen reader.
So basically i definitely need a "close" aria-label here:
<button>x</button>
But in some cases I have a placeholder for example, which is read by the screen reader. Do I need to add an aria-label anyway just in case? The aria-label would be the same as the placeholder.
#mikkel has good advice regarding the first rule of ARIA use.
Regarding your specific question on the placeholder attribute, relying on the placeholder as your label would fail several WCAG checkpoints.
Placeholder text is typically light gray and when displayed on a white background often fails 1.4.3 Contrast Minimum
The placeholder text disappears when you start typing so now the "label" has disappeared and would fail 3.3.2 Labels or Instructions
The placeholder attribute is not specifically referenced in the accessible name calculation (https://www.w3.org/TR/accname-1.1/#step2) although it might be considered in step 2D as "an attribute that defines a text alternative". It's not clear if placeholder is a "text alternative". Personally, I don't think it is. If not, then you would fail 4.1.2 Name, Role, Value
If you look at the spec for placeholder, it has a big disclaimer about not using it as a label.
Warning: Use of the placeholder attribute as a replacement for a label can reduce the accessibility and usability of the control for a range of users including older users and users with cognitive, mobility, fine motor skill or vision impairments. While the hint given by the control’s label is shown at all times, the short hint given in the placeholder attribute is only shown before the user enters a value. Furthermore, placeholder text may be mistaken for a pre-filled value, and as commonly implemented the default color of the placeholder text provides insufficient contrast and the lack of a separate visible label reduces the size of the hit region available for setting focus on the control.
So, all that being said, yes, you should have some kind of visible label associated with your input field even if you are using the placeholder attribute.
Short answer, no.
Long answer, it depends on the situation.
But important – first rule of aria:
If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of re-purposing an element and adding an ARIA role, state or property to make it accessible, then do so.
When in doubt, choose native HTML.
https://www.w3.org/TR/using-aria/#rule1
If you have a visible label, then you should connect the label text and the input field via the label-element.
If the input field does not have a visible label, the aria-label is one technique that can add the label semantically.
In your example of the button, you should use an aria-label, as the "X" doesn’t give the user any information. Of course, most users can guess what an "x" dos, but the user should not have to guess.
And here am talking of users who use assistive technology.
I would recement that you get a professional to test your site, for legal reasons but mostly for your users.
I'm a web developer, but have used the last 10 years on web accessibility. So far, it’s the hardest field of web development I hav had to learn and I'm still learning. 😊

NSTextStorageDelegate's textStorage(_,willProcessEditing:,range:,changeInLength:) moves selection

I'm trying to implement a syntax-coloring text editor that also does things like insert whitespace at the start of a new line for you, or replace text with text attachments.
After perusing the docs again after a previous implementation had issues with undoing, it seems like the recommended bottleneck for this is NSTextStorageDelegate's textStorage(_,willProcessEditing:,range:,changeInLength:) method (which states that Delegates can change the characters or attributes., whereas didProcessEditing says I can only change attributes). This works fine, except that whenever I actually change attributes or text, the text insertion mark moves to the end of whatever range of text I modify (so if I change the style of the entire line, the cursor goes at the end of the line).
Does anybody know what additional call(s) I am missing that tell NSTextStorage/NSTextView not to screw up the insertion mark? Also, once I insert text, I might have to tell it to move the insertion mark to account for text I've inserted.
Note: I've seen Modifying NSTextStorage causes insertion point to move to the end of the line, but that assumes I'm subclassing NSTextStorage, so I can't use the solution there (and would rather not subclass NSTextStorage, as it's a semi-abstract subclass and I'd lose certain behaviours of Apple's class if I subclassed it).
I found out the source of the problem.
And the only solution that will work robustly based on reasons inherent to the Cocoa framework instead of mere work-arounds. (Note there's probably at least one other, metastable approach based on a ton of quick-fixes that produces a similar result, but as metastable alternatives go, that'll be very fragile and require a ton of effort to maintain.)
TL;DR Problem: NSTextStorage collects edited calls and combines the ranges, starting with the user-edited change (e.g. the insertion), then adding all ranges from addAttributes(_:range:) calls during highlighting.
TL;DR Solution: Perform highlighting from textDidChange(_:) exclusively.
Details
This only applies to a single processEditing() run, both in NSTextStorage subclasses and in NSTextStorageDelegate callbacks.
The only safe way to perform highlighting I found is to hook into NSText.didChangeNotification or implement NSTextDelegate.textDidChange(_:).
As per #Willeke's comments to the OP's question, this is the best place to perform changes after the layout pass. But as opposed to the comment thread, setting back NSText.selectedRange does not suffice. You won't notice the problem of post-fixing the selection after the caret has moved away until
you highlight whole blocks of text,
spanning multiple lines, and
exceeding the visible (NSClipView) boundaries of the scroll view.
In this rare case, most keystrokes will make the scroll view jiggle or bounce around. But there's no additional quick-fix against this. I tried. Neither preventing sending the scroll commands from private API in NSLayoutManager nor avoiding scrolling by overriding all methods with "scroll" in them from a NSTextView subclass works well. You can stop scrolling to the insertion point altogether, sure, but no such luck getting a solid algorithm out that does not scroll only when you perform highlighting.
The didChangeNotification approach does work reliably in all situations I and my app's testers were able to come up with (including a crash situation as weird as scrolling the text and then, during the animation, replacing the string with something shorter -- yeah, try to figure that kind of stuff out from crash logs that report invalid glyph generation ...).
This approach works because it does 2 glyph generation passes:
One pass for the edited range, in the case of typing for every key stroke with a NSRange of length 1, sending the edited notification with both [.editedCharacters, .editedAttributes], the former being responsible for moving the caret;
another pass for whatever range is affected by syntax highlighting, sending the edited notification with [.editedAttributes] only, thus not affecting the caret's position at all.
Even more details
In case you want to know more about the source of the problem, I put more my research, different approaches, and details of the solution in a much longer blog post for reference. This here, though, is the solution itself. http://christiantietze.de/posts/2017/11/syntax-highlight-nstextstorage-insertion-point-change/
The above accepted answer with the notification center worked for me, but I had to include one more thing when editing text. (Which may be different from selection).
The editedRange of the NSTextStorage was whack after the notification center callback. So I keep track of the last known value myself by overriding the processEditing function and using that value later when I get the callback.
override func processEditing() {
// Hack.. the editedRange property when reading from the notification center callback is weird
lastEditedRange = editedRange
super.processEditing()
}

Is there a SetText message for the Win32 ListBox control?

This is easy in .NET (not my question) but I'm trying to figure out if it is possible to simply change the text of a string in a Win32 list box control given an index.
There is a GetText function that takes an item index but nothing to change the text of an existing item/string. My workaround will be to remove it and add it back in the box (which is also a weird prospect since there is no single command to add a string + item data -- these must be done carefully by inserting the string and then setting the item data on the index of the inserted string, which is tricky (not possible?) with sorting active).
Yes, the lack of a LB_SETITEMTEXT message is a bit weird.
You should put your Delete+Insert+SetData calls between calls to WM_SETREDRAW...
At the risk of being off topic...
I tend to use the ListView control all of the time. You'll want it in report view to mimic a listbox, and, as a plus, it supports multiple columns.
Oh.. and it has a LVM_SETITEM Message :)
http://msdn.microsoft.com/en-us/library/bb761186(v=VS.85).aspx
Although this question is old, but I think this documentation presented by Microsoft will be able to answer anyone questions based on this one.
So according to Microsoft documentation which you can find here
Changes the text of a list-view item or subitem. You can use this
macro or send the LVM_SETITEMTEXT message explicitly.
void ListView_SetItemText(
hwndLV,
i,
iSubItem_,
pszText_
);
And it also presents other macros for managing the list box. You can build a wrapper around this macros to simplify handling list view controls, etc.

How can I enhance the aesthetics of an ugly windows form packed with too many (necessary) features?

One of the window dialog of a software I'm working on looks a bit like this : (original screen-shot copied from this coding horror post, other examples available on this SO question)
The thing is that none of the options can be removed (those who can have already been), and that they must all be visible at a glance (i.e. no tabs allowed) Edit : I've added a comment explaining why tabs are not an option in my specific project.
I've tried to use colors, to add icons, but it just added to the overall feeling that someone had just dropped controls randomly using Visual Studio Form designer during a summer internship.
How can I make this dialog more user-friendly less horrifying without deleting features ?
Edit :
The GUI example I took has a lot of obvious design flaws (see those answers 1 2), but even after fixing those (which I've done on the software I'm working on), the dialog still looks pretty ugly.
Below is another example (credit). Controls are (almost) lined up correctly, appropriate controls are used, etc, but the overall result still looks terrible :
(source: judahhimango.com)
Given the constraints I think you won't have many options.
A good starting point would be to equal the alignments and control distances to increase overall symmetry with the ultimate goal to reduce visual clutter.
Examples:
The group boxes "Special" and "Running options" should have equal height.
The distances between the four buttons "Save settings" and "Exit" should be equal.
All buttons should have the same height, if possible avoid word wrapping.
Use the same height for all single-line edit boxes.
The quota label and its text field should be at the same baseline.
The distance between a group box caption and its first control should be equal (compare "Running options" to "Retrieval options")
Increase the distance between the controls in general, i.e. make the form look less dense.
Content fixes:
Use the same captions/names for the same things. For example, you use "Append to logfile" but "Overwrite Logfile
Use the same character case, sometimes it's "Only the first one", "Every Single Word" and sometimes "it is Camel-cased". Decide on one scheme and use it consequently (Sentence case and Title case are the most common)
Don't try to be cool, "Go 2 background" doesn't look very professional.
Avoid controls with unreadable shortcuts or no content at all. It doesn't help if the user has to stop on every control and think: "What does this thing do?"
Some more radical/controversal changes:
Try making the group boxes more symmetric, possibly be re-positioning them and use the same height. If necessary use two columns of checkboxes, that would still look better than uneven group boxes.
Unless it's absolutly necessary, remove the horizontal scroll bars from the two multiline edit boxes
Get rid of the "Clear" buttons. For the list box on the buttom left you have to provide some other way to delete items, perhaps make this into a multine text box, too.
Try replacing the checkbox collection with a checkable list box or a property grid.
A rule of thumb:
Imagine the lines of the bounding box of each control lengthed until it reaches the form boundary. The less different lines reach the boundary, the better. (Because correctly aligned controls produce more incident (-> less unique visible) lines)
On the use of colors and icons:
Simply adding icons and colors doesn't solve the fundamental problems such forms have. They all suffer from being overloaded with controls and adding even more only worsens the problem, because they just add more visual noise, but don't provide any more visual cues.
The problem with your examples, and the reason that they look cluttered is that there's not enough spacing between the elements. You think you're saving space by making things smaller, and putting them closer together, but it's a false economy because your eyes have to work harder to differentiate elements from eachother. Think about writing a computer vision program that had to OCR those interfaces, and the challenges you'd have just figuring out which element was which, let alone what the type says.
Regardless of what your programmer efficiency instincts might say.. it's okay to put space between your elements, and hell, it's okay to even have large amounts of completely "wasted" space too.
have a look at this
There's a clear boundary between the flower and its background. The shallow depth of field of the photography gives a clear contrast, and allows you to very rapidly construct a mental sillouette.
jungle http://www.statravelbuzz.co.uk/wp-content/jungle-taranaki-new-zealand.jpg
what's going on in this image? There's too much detail, and it's all over the place.
have a look here
http://www.papress.com/thinkingwithtype/text/line_spacing.htm
(source: papress.com)
think about what the line spacing is doing to your ability to distinguish words from eachother. What's it doing to the visual sense of clutteredness?
You can see from the type example that you don't have to give up much in terms of space efficiency to see massive gains in visual appearance.
grid systems
grid systems http://ecx.images-amazon.com/images/I/51kcWOOyUoL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA240_SH20_OU01_.jpg
thinking with type
other reccomendations:
stop stealing sheep
elements of typographic style
the design of everyday things
the humane interface
If you've already dealt with alignment and organizational aspects as much as you can, then your problem probably is the graphic design of the controls. Heavy 3-D controls in large numbers are detrimental to the aesthetics and usability of a window. Consider editing their properties to flatten and lighten the controls’ appearance, using something I call “compact presentation.” In addition to removing the ugliness and distraction of heavy borders and backgrounds, this also allows controls to be placed closer together, freeing white space for grouping them without resorting cluttering lines and frames.
It looks something like this (after also fixing alignment and redundancy along with a little re-arrangement of groups):
(source: zuschlogin.com)
If you're on WinForms, One trick I've found useful is to pack multiple-instance data in a DataGridView, and single-instance data in a PropertyGrid. Both these controls help you pack lots of information in very small space, and still give you full control over their visualization (you can add descriptions, tooltips, etc.)
The thing is that none of the options
can be removed (those who can have
already been), and that they must all
be visible at a glance (i.e. no tabs
allowed)
Sigh. I would argue that, because everything is visible at a glance, they practically become invisible in a sea of controls.
That being said, the ff (yes another list) are my suggestions:
To reduce clutter, make the overall form bigger, and all controls more widely spaced apart in all directions
Standardize the height of the controls, e.g., textboxes must all have same height, buttons all have same height, etc
Align labels with text boxes more consistently
Make the layout flow down instead: 1 column, with each group having the same width as all other groups
Set all group box names in bold to make them stand out
Put all those "wGetStart.bat" commands in a group of its own
If you really want to learn more about making it "flow", with or without getting rid of all this "visible" information, you might wanna get a copy of Steve Krug's Don't Make Me Think:
Because tabs are not allowed, you can create a more grid like layout.
Adding detachable panes for related options and commands can help the user to organise them, at least. If they can be minimised/unpinned when not needed, then they can also free up valuable screen estate and unclutter the UI. See VisualStudio itself for a nice implementation.
Here's my random selection of suggestions:
make it bigger, this allows a more structured grouping by reducing the space constraint on each group
add some structure by grouping options that the user might want to combine at the same time
add meaningful headers (might require the previous item). "special", "running options", "retrieval options" don't really convey any useful information.
make sure that only options that can be combines randomly are checkboxes (for example are "no info", "all info", "some info" really completely independent options? Same for "append to logfile", "overwrite logfile").
use appropriate controls (spinner for number entry, file selection dialog for files, radio buttons for mutually exclusive items, ...)
deactivate controls that make no sense with current configuration (for example custom directory text field).
move all actions to a single place
hide the scrollbars unless they are actually needed (i.e. reduce visual clutter)
be more consistent (why is it "running options" and "retrieval options" but not "special options"?)
One thing that you may have, but is obvious for the WGET example is the use of a main menu, e.g. File, Edit, Tools, Help. And also a button bar too?
First, define a hierarchy of control blocks. Even if everything must be visible, I think that some functions are more important than others. Also, make a clear separation between functions that apply to the domain (e.g., Start wGetStart.bat) and functions that apply to the software (e.g., Save settings).
Second, organize the layout according to this hierarchy: most essential to the top and to the left.
Third, let your design breathe. Space is fundamental for defining content.
Since no one has said this yet, I will: your window isn't really all that bad. Yes, it's ugly, and yes, I would be personally embarrassed to admit that I designed an interface that looks like that.
However, this window only produces a negative reaction the first few times you look at it. Once a user has used this form a couple of times, they will stop seeing it as a random collection of controls and instead start perceiving it as an interface that lets them see every piece of information that they require at a glance and that lets them do everything they need to do with a few mouse clicks.
It's a dialog for setting a bunch of options, and it's probably perfectly functional and not a big deal at all for your users. You could put a lot of work into some weird, fancy-schmantsy replacement UI that might impress the StackOverflow code-noscenti, but we don't pay your salary.
Now, the second window - that's a piece of crap.
Without knowing both the content your application and what it currently looks like, I can only guess at the problems you are facing, but here goes.
You say that this is being used by traders. While I have never dealt with that segment of the market I have often dealt with executives who need very specific information to run their businesses and the first cut of the application almost always looked like what you have displayed.
The original solution back in the day was to build a very light custom interface for each user of the application focusing on only the information relevant to that person. More recently the move has been toward making the interface customizable by the end user.
Chances are that none of your users are using all of the information presented to them. Each of them is using only a small subset. But each user is using a different subset. Try building the software so that each user can display only the information that they will be basing their decisions on.
Aside from other much-needed changed, adding a banner (displaying the company logo or something like that) seems to improve the overall appearance of the dialog.
I know it's a pure waste of space but it seems to improve the global feeling about the window.
alt text http://img24.imageshack.us/img24/3423/wget.jpg
Duplication - they might all have to be available instantly, but they could be available elsewhere as well. So you can have a keyboard accelerator, menu option, detachable panel, tabbed area ...
So this existing form could be the main, default interface (albeit improved with some of the other good design tips in other answers), but why not create an "expert" panel which can be a lot neater and try to work your users on to that, and away from this old "do everything" blotter.
I would really consider evaluating the usability goals of your project. Figure out what users want to do most frequently and most consistently with your application and default to that.
You should consider a wizard for this UI. Guide the user through a set of screens for the first use. And move many of these features as configurable options preferences.
Usability is not merely aesthetics IMHO. It is about making clear what the app is intending to do. I would refactor this app to provide shortcuts to common options patterns. If 90% of the time I am going to use a specific configuration of options why do I need to see every feature enumerated in the UI 100% of the time? It is just unnecessary clutter. Sensible defaults powerful configuration that is the goal. You don't have to sacrifice features, in a sense not making me think is a feature, perhaps the most important feature.
With respect to your specific app I would rework it with two basic screens a clean default screen and an advanced screen. Add the ability to create shortcuts to common configuration sets on the default screen. A simple button that maps to a specific configuration set and asks me for a url. And if the user needs to tweak an option present them with the advanced screen but treat it as preference configuration screen that saves the preference out to a shortcut button. If I want to use the configuration more than once let me save it as a custom bookmark or option on the defaults screen.
This is one of the things OS X does really well. There is a lot of power and customizability in OS X, "hidden features" if you will. But the OS defaults to sensible and straight forward options. Provide tools to the power users but don't clutter the system for the first time or casual user. This is not sacrificing functionality, it is effectively organizing functionality.
That is my first suggestion. But if absolutely don't want to hide options, I would make this a long scrollable vertical list organized in clear steps with explanation for each step:
Step 1: Provide URL ______________
Step 2: Configure Hosts _____________
Step 3: Configure Retrieval Options:
() option
() option
() option
() option
And so on...
At each step provide some context to the meaning of the configuration options.
The advantage to this is that you can clean up the UI aesthetically and provide useful configuration hints. I don't know what "Empty wGetStart.bat" means. I presume this empties a batch file of some sort. Provide me an explanation so that I know whether I want to click that button or not. And then let me hide explanations under a collapsible menu if I use the interface regularly.
My two cents.
This may not be appropriate, but...
Hide all the options in a stylesheet, much the way that all the paragraph formatting options are hidden in a word processor. Most of the time, the user just picks a named style. When the scary stuff is necessary, a click of an 'Advanced' button can grow the form to show all the options at a glance, to allow a few to be overridden, or to allow new named styles to be defined.
Obviously, a major advantage is that if there are a few particular configurations that are regularly used, it's trivial to switch between them and there's very little risk of accidentally setting one of the options wrong.
Another option - don't have all your options on display, use tabs or a wizard or whatever. Instead, have a text list of all options currently set (or all options in non-default states or whatever) to get the at-a-glance visibility.
These could be combined, so that your summary display says something like "like <style name>, except for ...", based on the style that's least different to the current options.
In a comment you say that a user "HAS to have all information available at once". Does that mean they have to see all the checkboxes and frames and scrollbars at once, or just the information?
For example, instead of having a multitude of checkboxes for option 1, option 2, option 3, etc, in the main GUI, only show the selected options and give the user a way to open a configuration window when they need to change something.
Instead of this:
+- Feature Set X - +
| |
| [x] option 1 |
| [x] option 2 |
| [ ] option 3 |
| [x] option 4 |
| |
+------------------+
show this:
feature set x: option 1, option 2, option 4 [configure...]
This lets the users see all the selected options without having to take up valuable real estate for all of the widgets necessary to change the values.
(apologies if the ascii art doesn't appear right -- it looks right in a fixed font :-\ )
An interesting article on this topic:
Managing UI Complexity by Brandon Walkin.
In the second example I would remove most of the arrows from the right hand side box. I would add the ability to click and drag to change the number(if your users are used to that I know several 3d packages that do it so it wouldn't be uncommon in relation to the example). You can change check boxes to buttons with backgrounds that change color or stay depressed when clicked as another option to reduce visual clutter.
In the right hand side box there are two or three separate functions mixed together that very well could get their own tab. When you are working with an object's color and texture you aren't going to be changing its size and view aspect ratio so having them right there means they are in the way. At the very list they need to be rearranged to be in some sort of logical order right now they are all over the place. Texture and color(things that effect color) should be together. Position rotation and view(things that effect shape\size) should be together.
It has already been said, but without seeing your application we can't give you a concrete answer on how to make your dialog less horrifying. If you can't post screenshots, then the best advice I can give is to hire a designer to help you work on the graphical end of your application; otherwise all you will get are general guidelines here.
Some things that might have not been discussed:
Think about the users of your applications and the systems that they run. I believe that most stock traders will have large dual monitor setups, so you can probably make your dialog larger and add space between your controls to make it look less cluttered. You should research your audience and see what they use.
Are you using the best controls for the job? In the first screenshot you posted I noticed a few controls that could be changed:
a. Under "Running Options" I see three checkbox options called All Info, No Info, Some Info. If only one can be selected at a time then maybe they could be changed into a drop down selection menu. Also under the same "Running Options" there is Append Logfile, Overwrite Logfile, which again you can convert to a drop down menu since you can select only one.
b. The two text fields where you can put in hosts, can probably be combined into one gridview with three columns. The first column is the host, the second is a checkbox for Accept, and the third is a checkbox for Reject.
By simply using different controls, we can still see everything we need but have less controls on the application.
Again, like I said above, witout seeing YOUR applications I can't really give you any specific suggestions.
Hope this helps.

How to implement (UI-wise) a button

I am designing the (G)UI of a program, and have stumbled across a problem; The program will convert a number into different units, and the layout of a unit been converted to is:
[Unit name (when clicked gives information)]
[Special status, if any]
[Output in textfield that can also be used for input (to convert to other units)]
I want the user to be able to copy an outputnumber onto the clipboard, without having to mess around with highlighting and finding the right buttons to press. So, I thought I'd make a button after the text-output field, saying something like "C" or "Copy".
But I was reading on joelonsoftware.com yesterday, and discovered that users seem to be cursorclumsy. So what should I do?
I've thought about a number of different options:
Click on textfield to copy to clipboard - BUT: I want to use it for input as well
Pressing a numeral on the keyboard to copy the respective one - BUT: There will probably be more than 10, and I need them for new input
Bigger Copy button, like on that actually says "Copy" - Hmm, would this work? I know that I like to use the keyboard when I can, so a solution involving it would be nice.
Each unit will have its own space, where everything (name, textfield etc.) fits in. What if it would copy to clipboard when clicked anywhere in that space except for on the name or textfield. - BUT: What if you miss, meaning to click below one textfield, and clicking above another?
But what about highlighting the unit's space as I went along? - Could still mean trouble...
What do you think? I think I just might opt for #3 - Bigger copy-button..
There's nothing wrong with a Copy button after every field if you feel that it's going to be a very common operation.
Two suggestions, however:
In terms of look and feel, make sure that the button is clearly associated with the field. For a text field, the best way to do this is to put the Copy button inside the text field (on the right side - but be prepared to handle RTL languages by switching its position as needed!).
To avoid making it overly big, don't use any text, but rather use the stock Windows icon for Copy (like this one: ), and put the text into its tooltip. If you do that, you may also get rid of button border entirely, further reducing its size, though you'd still want some visual hover indicator to make it clear that it's an active UI element. In fact, you might want to specifically copy Vista/Win7 Explorer (also seen in IE7/8) UI for location field and the Reload icon in it.
I think the solution #3 is the best in your list, but I would like to see a sketch of your GUI.
What ever you do, it is important to use the OS standard keyboard and mouse event bindings and preferable look-and-feel too otherwise users get confused.
For sheer speed, the keyboard is the way to go. How about letters A-Z to copy the text boxes instead? Skip “E” to allow scientific notation to be inputted. Potential speed is high, but learnability is low. I’d expect users will have a hard time figuring out this UI even with explanatory text on the page/window, and if users have to read explanatory text, then the time that takes will likely negate the time savings of the UI, unless the user is using the app all the time (Joel also writes correctly that users hate to read).
For an app that will be used only occasionally, the big button is a better choice, the bigger the better, as predicted by Fitts’s Law. And absolutely label it “Copy,” not “C” and not an icon, to maximize learnability. Your other ideas have learnability and tolerance issues without the speed of the keyboard.
That said, I think you’re taking what Joel says too far. Certainly you want to eliminate unnecessary clicks, but the typical design for this type of app would require one click on the text box (which should by default highlight the whole value) followed by one click on a Copy menu item –or better, Alt-C or Ctrl-C from the keyboard. It’s hard for me to imagine a task where saving one click or a couple keyboard presses would be worth the clutter of a bank of Copy buttons beside your text boxes. Are you also going to have buttons for Paste and Clear? At some point the clutter will slow your users down more than the extra click.
How often are users going to be copying? If it’s really dozens of times per session, then you should re-think the whole design approach because any copying and pasting of one number at a time is going to get tedious. Maybe you should support batch processing, taking multiple numbers at once and outputting results in a form already suitable for the expected use. Maybe have it work within other apps like the way Enso does: user highlights a number in any document or text field of any app, commands Convert - Feet - Meters and it’s changed in the document or field.
If you accidentally click on the wrong area, you could just click on the right area after that. If your issue lies in the user not knowing when they click on the wrong area, just highlight the last-clicked area.
Is there a problem with copying whatever is in the textfield when they click on it? So what if it's being used for input? They're just going to copy the value they need after they type values in.
You could also have a ctrl-click or shift-click in the text box be a copy.
Most people know how to copy text on their own computer. Perhaps the best solution is to just auto-highlight all the text in a textbox when it gets focus so they can just ctrl-c to copy or start typing to begin input.

Resources