Draw "red squiggly line" in CHtmlEditCtrl - c++

I am working on building spellchecking functionality into my app which currently uses MFC's CHtmlEditCtrl control.
Is there a way of drawing one of those "red squiggly lines" that you see under spelling errors on the HTML control, underneath the word that I detect to be a spelling error?
The only way I can think of is to use the actual HTML to apply this style, and then strip it out upon the email being sent. This seems rather messy, as if the user starts applying underline styles to the text they could interfere with it.
Is there a way of doing this with drawing?
Thanks in advance.

The interface you want is IHTMLRenderStyle. You pass this, once filled in, to the AddSegment method of the of the IHighlightRenderingServices interface. Here's an example in (gasp) VB. I've done it in C++, years ago now though, and it worked nicely.

Related

Making a fancy looking window with messages stack

I try to make fancy looking messages viewer, where messages divided by formatting, other background of smth. similar. They need to looks like this - http://pastebin.com/GU1Lq087. What I found in wxWidgets to solve this problem, and why I can't use it:
wxHtmlWindow
Supports minimal HTML (a few tags). But big problem with this - html representation doesnt fill parent window. So element with width=100% will have 100% width only on standard window size. And even p tag doesnt have word wrapping (long long paragraph goes in one line with vertical scroolbar).
wxWebWiew
I need to have the ability to set generated HTML to it, but IE must to load some page first and I can rely only on IE background. It has some time to load page, even if I set HTML-string.
wxRichText
Most suitable for me. But I can't draw line like HTML's hr, or change background for the entire message block (to distinguish it from common background)
I need to show messages like this. But i didn't know how and which tool is better.
One way of achieving this would be using wxWebView with WebKit backend but I am afraid that Windows can only use IE's engine. However, there is project which allows you to use Gecko engine. I use WebKit for rendering chat in my application and it works really good (although I am using Qt). (http://www.kirix.com/labs/wxwebconnect.html)
You can always do it regular way - just create separate widget (I think it is called "frame" in wxWidgets) for single message. This way you get almost infinite possibilities. E.g. you can make "AbstractMessage" with virtual methods and then things like "AdministratorMessage", "MOTD" etc. will be a breeze.
wxRichText Most suitable for me. But I can't draw line like HTML's hr
Really? Have you looked at the docs?
( http://docs.wxwidgets.org/trunk/overview_richtextctrl.html )
Here's a couple simple ideas:
a. Write a line of blanks, underlined.
http://docs.wxwidgets.org/trunk/classwx_rich_text_ctrl.html#a333b2e675617ed2299cf91e7c0dbd0d8
b. Create an image of a horizontal line, display it using WriteImage
http://docs.wxwidgets.org/trunk/classwx_rich_text_ctrl.html#a1315611c0741d03e852ee26eba3a9d94
The funny thing is that what you want can be done using any of the 3 controls you mention. With wxHtmlWindow you just need to set its size correctly, with wxWebView I don't understand what your problem with it is at all and with wxRichTextCtrl you could just use separate controls for the areas with different backgrounds (you could almost certainly use a single control with different styles but using several controls seems simpler).

C/C++ code highlighting looks weird in a web page

My emacs have a black background and white text. If I convert org-files to html code-highlighting will probably look weird. In particular, the displayed "main" and "[]" are basically invisible.
How to make it look beautiful, or at least clearly readable?
see here http://att.newsmth.net/nForum/att/Emacs/101182/527
I'm not sure I understand what your problem is, but if you just need a good color scheme for code-highlighting, try solarized, it's an amazing color scheme, and there is a theme for emacs already made by someone.

Using TGlowEffect on a TLabel in Delphi/C++ Builder

This is a pretty easily explained problem, I'm using FireMonkey to design a form and when I add a TGlowEffect to a tag it ruins the way the Label looks.
If somebody knows how to do this correctly I would appreciate it.
After applying the TGlowEffect:
The text is significantly bolded, and the only affect applied was the blur.
The text only appears like this in the editor, but I would rather it look like it's going to look after I compile.
Maybe I'm just new to FireMonkey and I'm doing something wrong, if anybody has any good reference material on how to work with FireMonkey correctly I would appreciate a link to that also.
If you have not already done so, you should apply update 4 (be prepared for fuzzy fonts though) as I have attempted to reproduce this issue without success with my XE2 (updated to 4). Some more information on what you are actually doing would be useful :-)
As a general thought, rather than adding a glow effect to a label or to a text object, you should change the component style to add a glow effect - this way you can easily apply the same style to other text or labels.

help with type of window dialog resource needed

I am writing a windows program (no mfc) and need to output a status line to the operator every few seconds or so. I tried using rich text boxes but after so many hours it seems to hang up. Does anybody have an suggestions on what I can use instead?
People mentioned that my buffers might have been exhausted. I thought I had planned for that. After I had about 1000 lines displayed I would take the first 500 and remove them using the select and cut options in rich text boxes. I still ran into the same problem.
This question appears relevant, and this one too. But they don't give any concrete recommendations for an alternative to rich text boxes.
You might try the Scintilla control (scintilla.org) which does not appear to have any hard limitations on text size. It has a permissive license. It is used by many text editors such as Notepad++, Notepad2, Code::Blocks, FlashDevelop. I haven't tried it personally but there from the documentation it looks easy to use it in a Windows API application. Of course, it might be overkill for your purposes.
If you keep appending to the text in the control every few seconds for hours then you are probably running into some memory constraint on the control or the process. I think you would have this problem with any control you choose given update frequence and how long you're running the program.
Have you considered implementing a simple circular buffer for the content of the text box? Say only keep the last hour's messages. You could maintain a separate log file for history if the operator needed to go back in time for hours.
I ended up writing my own control to do this, essentially duplicating the Output window in Visual Studio. It was a success, but it ended up being much more code than I thought it would be when I started - I insisted on features such as auto-scrolling when the cursor was on the last line, select/copy, bold text, etc. It was backed by a std::deque so I could limit the number of lines stored for the window.
Unfortunately the code belongs to a former employer so I can't share it here.

Window like control in SketchFlow?

I've been playing around with SketchFlow from Microsoft and one thing that bothers me is that I cannot seem to find a window looking like sketch.
I would like it to have title bar and 3 "buttons" like all normal windows do (minimize, maximize, close buttons).
In Balsamiq Mockups this is very easy, however I don't see any kind of window-like sketches in SketchFlow.
I'm trying to mockup future desktop application.
You are correct that there isn't one built in. In SketchFlow you can easily make "component" screens that can be used multiple times. To create what you are looking for you could combine a sketch rectangle, with a couple of buttons and a textbox. You can select all of this content, right click it and make it into a component screen.
The MockupsLibrary also provides the mockups you are looking for. Once you've installed it, it'll appear in your assets as "ButtonWithIconMockup". You can select the "WindowMinimize", "WindowMaximize", and "WindowClose" for your IconImage attribute to get the desired result.
With Expression Blend 4, you can install the Mockup Controls by following the instructions at How to add mockup controls to your Expression Blend library. In the new Assets | Mockups category you will see a WindowMockup item that does exactly what you wanted.
To play around with the Mockup Controls, try the MockupDemonstration sample from the Help Welcome screen.
Unfortunately, there doesn't seem to be a builtin MenuStrip yet (although you can laboriously build one yourself from the non-sketchy SimpleMenu and SimpleMenuItem controls)? Also there doesn't seem to be any support for indicating keyboard accelerators (prefixing the desired letter with & doesn't work).
In general, it seems like Sketchflow really isn't designed to be used to prototype standard desktop applications?