Programming related :
Programming related :
Which language and version?
I know how C# works and you can certainly change the label
text and make textBox readOnly.
Hello all,
Programming related :
I've got a simple dialog on which I placed a riched20a control which I have given, among others, the ES_READONLY style. The result is that I cannot edit the text itself. Which is what I was after.
However, I was rather surprised to discover that some shortcut-keys affecting text-formatting (ctrl-R, ctrl-L and likely more) still work. :-(
Question : How do I make the text *really* read-only ? *inclusive* text-formatting.
Is that possible at all ? Which style would I need to add/remove / which GWL_* bit would I need to set/clear (I've not seen anything in that regard) ?
Remark: I need to be able to select-and-copy text from it though. Using the mouse or keyboard.
Regards,
Rudy Wieser
ES_READONLY works fine in both rich-edit and plain-text mode.
Did SetWindowLong() actually succeeded?
Did the style actually been applied?
Hello all,
Programming related :
I've got a simple dialog on which I placed a riched20a control which I have given, among others, the ES_READONLY style. The result is that I cannot
edit the text itself. Which is what I was after.
However, I was rather surprised to discover that some shortcut-keys
affecting text-formatting (ctrl-R, ctrl-L and likely more) still work. :-(
Question : How do I make the text *really* read-only ? *inclusive* text-formatting.
Is that possible at all ? Which style would I need to add/remove / which GWL_* bit would I need to set/clear (I've not seen anything in that regard)
?
Remark: I need to be able to select-and-copy text from it though. Using the mouse or keyboard.
Regards,
Rudy Wieser
...Question : How do I make the text *really* read-only ? *inclusive*
text-formatting.
Convert to jpg, pdf? Overlay with transparent level?
JJ,
ES_READONLY works fine in both rich-edit and plain-text mode.
Why ? Why are you saying that (without any kind of explanation) when I just described how it *doesn't* "work fine" ? :-(
Did SetWindowLong() actually succeeded?
As mentioned, I included the style when defining the control (in the programs resource-file).
Also, a rich-text box has a EM_SETREADONLY message available.
https://learn.microsoft.com/en-us/windows/win32/controls/em-setreadonly
(Remarkably, it says /absolutily nothing/ about why it should be used instead of just changing the GWL_STYLE bit)
Thanks for reminding me though : I've tested sending that message, but alas, the effect remains the same : I can't edit the text, but can still edit the formatting (even add bullet-points!).
Did the style actually been applied?
Well, as mentioned I can't edit the text itself anymore, which indicates to me that it has.
But as it so happens I just tested it using GetWindowLong(). It was.
Regards,
Rudy Wieser
Though from my tests in Win2000, WinXP, and Win7, the results
are a bit different than yours. Only the line spacing shortcuts
(CTRL+1, CTRL+2, CTRL+5), and Cycle Bullet Style shortcuts
(CTRL+SHIFT+L) still able to change content in read-only mode.
All other shortcuts (CTRL+L, CTRL+E, CTRL+R, CTRL+=, CTRL+SHIFT+=, CTRL+SHIFT+A, etc.) are not able to change content in read-only mode.
That's a RichEdit bug! Mainly because the read-only feature is
partially functional.
FYI, RichEdit v2.0 which is used in Win9x/ME/NT4 doesn't
have any text formatting keyboard shortcuts yet, so it's
likely a bug in RichEdit v3.0+.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 64 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 492937:50:53 |
| Calls: | 842 |
| Files: | 1,304 |
| Messages: | 261,666 |