selected color

Mar 29, 2013 at 8:33 PM
Edited Mar 29, 2013 at 9:13 PM
Hi there,

Is there a control-specific way to change the selected fore color and back color? Something I'm overlooking perhaps?

For example, all of my custom controls I've written for my app have SelectedForeColor and SelectedBackColor properties so that the app will use these colors for selected text instead of the system-defined colors. If these properties are set to Color.Empty, then my controls use the system defined colors. Otherwise they use the colors defined by the control.

If there isn't a way to do this today in HtmlRenderer controls, then I can will gladly add the SelectedForeColor and SelectedBackColor properties to the controls for the future and alter the rendering code to use them. I just wanted to make sure you were OK with adding this to the controls going forward so that I won't have to keep merging the changes.

Or if you already have this capability, please point it out to me. Perhaps I can control it with CSS for example?

EDIT: there is a way to do this in CSS but it isn't supported in IE, and apparently not HtmlRenderer either. It uses either the ::selection style or ::-moz-selection style depending on browser:

http://stackoverflow.com/questions/2990566/selected-text-background-color

However, since there is no single standard, I recommend just using the SelectedForeColor and SeletedBackColor styles. Firefox uses one syntax (::-moz-selection), Safari/Chrome/Opera use yet another syntax (::selection), and IE doesn't support it at all. Instead, since it's a globally applied style anyway, I think it's best to just use properties.

If you wanted to do it through CSS, then I recommend using ::selection, as it is supported by more browsers. However, I'm not sure I'd e comfortable making that level of change to the source. At least not until I had a chance to look at it and how styles are parsed. Adding the properties should be cake.

Please let me know what you think...

Thanks,
Ryan
Mar 30, 2013 at 5:04 PM
For now I just overwrote the selected back color const in CssUtils in my copy of the code. It would be nice in the future if the ::selection style property was present in the CSS that it would be properly evaluated and would affect the rendering of selection fore and back colors.

Thanks,
Ryan
Developer
Apr 21, 2013 at 1:00 PM
Next version will support ::selection style (in about a week)
Oct 19, 2013 at 6:03 PM
Hi Arthur, did this ever get added?

Also, I found an issue related to color selection.

If you select text, it will select whole-word visually. That's good.

However, if you then click Ctrl+C, it only copies where you had your caret hovered to, not the entire word.
Developer
Oct 20, 2013 at 3:40 PM
Yes, you can see it in "Text" sample in the demo app.

I can't reproduce the text selection issue.