|
-
Oct 24th, 2014, 11:02 PM
#1
Unicode Textbox
Here's my version of a Unicode & RTF textbox.
It's about as full featured as you can get while using the RichTx32.ocx control.
Full Unicode and RTF editing while in the IDE design mode. Just right-click and "Edit" to paste in your Unicode/RTF text.
Every single event, property, and method is passed through (with the exception of the data bound properties).
It's actually a bit like a mini-Unicode-word-processor while you're in the IDE design mode. Be sure to take a look at the Sel... properties. Usually, with the regular RTF box, those are only available at runtime, but with this control, they're all available at design time as well. Mess with them while in "Edit" mode of the control, and you can format your text while you're typing it.
The only downside is that pasted text (while in "Edit" mode), must be RTF (or ascii). There can be Unicode embedded in the RTF, but you can't paste "raw" Unicode. So what does this mean? It means you can paste pretty much anything from WordPad (and Word), and it'll go straight in (Unicode and all). Because, in these circumstances, there'll be an RTF representation of the copy in the clipboard. However, Notepad can do Unicode but it doesn't do RTF. Therefore, if you try to copy-and-paste Unicode from the Notepad, it won't work. However, if you copy from Notepad, paste to WordPad, then copy the same text from WordPad, and then paste into this control, it'll work. That's because WordPad will give you an RTF representation of the Unicode.
From WordPad, you can even paste pictures into it.
Please let me know what you think of it and whether you see any problem/enhancements from which it may benefit. Also, if anyone can figure out the pure-Unicode pasting, I'd be delighted to listen.
Enjoy,
UnicodeTextbox.zip
UPDATED: It'll now accept pasted (from clipboard) Unicode without the equivalent RTF being in the clipboard (such as what you'd get from copying Unicode out of Notepad). I also smartened up the Sel... properties so that they're always dynamically updated as you're typing without any typing lag. All of this is true regardless of whether you're in the IDE or during runtime.
UPDATE2: Ok, I added some shortcut keys to use while in "Edit" mode (design time or runtime). Things such as ctrl-b (toggle bold), ctrl-i (toggle italic), etc. It was just trivial to do compared to where I already was with this thing. I'm hopefully DONE with it for a while now. There's also a new property (TabStaysInside). This specifies whether a Tab inserts vbTab into control's text or moves to next control on the form. See the "About" property for summary of shortcut keys.
UPDATE3: Added a SelTextUnicode (both Get and Let) property. This allows you to select some text and then, during runtime, get that text in a unicode form. Or, you can insert unicode text at the carat (selection point). This is all runtime only because the control can just be directly edited at design time (and also, the properties window isn't Unicode compatible).
Last edited by Elroy; Oct 30th, 2014 at 11:43 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|