block edit after print
block edit after print
hello, is it possible for me to block changes to a certain block of texts?
I would like to block the editing of texts always after printing, so that even the point where it was printed could no longer be changed, but that there is the possibility of breaking the line after the printed point and continue editing and so on.
I would like to block the editing of texts always after printing, so that even the point where it was printed could no longer be changed, but that there is the possibility of breaking the line after the printed point and continue editing and so on.
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: block edit after print
As for me, the only simple and reliable solution is moving the printed part to a read-only TRichViewEdit or in TRichView, and to allow entering the rest of text in a separate editor. Seriously, consider using this method.
If you still want to use a single editor, it may be not very simple.
I can describe properties that can help.
Options of paragraph styles.
Protection of text styles.
TRVExtraItemProperty lists properties of non-text items.
Pay attention to
paragraph style Options:
- rvpaoReadOnly: makes the paragraph read-only, but does not protect from its deletion as whole (if it does not contain delete-protected items), and does not protect from adding new paragraphs when pressing Enter at the beginning/end of the paragraph.
- rvpaoDoNotWantReturns: blocks Enter keys in the paragraph
- rvpaoStyleProtect: protects from changing paragraph style (such as changing paragraph alignment)
text Protection options: rvprStyleProtect, rvprModifyProtect, rvprDeleteProtect, rvprDoNotAutoSwitch, rvprSticking, rvprStickToTop
non-text item property: rvepDeleteProtect, rvepResizable
---
Conclusion:
- protecting the whole paragraph is possible: [rvpaoReadOnly, rvpaoDoNotWantReturns, rvpaoStyleProtect], and delete-protect at least one item in each paragraph.
- or you can protect all text items [rvprStyleProtect, rvprModifyProtect, rvprDeleteProtect, rvprDoNotAutoSwitch, rvprSticking, rvprStickToTop]. But there is a problem for non-text items. While you can protect them from deletion and resizing, (if paragraphs are not protected) you cannot protect from insertion content before or after non-text items.
PS: the simplest way to apply changes in text and paragraph styles is ApplyStyleConversion + OnStyleConversion, and ApplyParaStyleConversion + OnParaStyleConversion, see the demos in TRichView\Demos\*\Editors\Editor 2, or a similar demo in ScaleRichView\Demos\*\RVDemos\Editors\Editor 2\
If you still want to use a single editor, it may be not very simple.
I can describe properties that can help.
Options of paragraph styles.
Protection of text styles.
TRVExtraItemProperty lists properties of non-text items.
Pay attention to
paragraph style Options:
- rvpaoReadOnly: makes the paragraph read-only, but does not protect from its deletion as whole (if it does not contain delete-protected items), and does not protect from adding new paragraphs when pressing Enter at the beginning/end of the paragraph.
- rvpaoDoNotWantReturns: blocks Enter keys in the paragraph
- rvpaoStyleProtect: protects from changing paragraph style (such as changing paragraph alignment)
text Protection options: rvprStyleProtect, rvprModifyProtect, rvprDeleteProtect, rvprDoNotAutoSwitch, rvprSticking, rvprStickToTop
non-text item property: rvepDeleteProtect, rvepResizable
---
Conclusion:
- protecting the whole paragraph is possible: [rvpaoReadOnly, rvpaoDoNotWantReturns, rvpaoStyleProtect], and delete-protect at least one item in each paragraph.
- or you can protect all text items [rvprStyleProtect, rvprModifyProtect, rvprDeleteProtect, rvprDoNotAutoSwitch, rvprSticking, rvprStickToTop]. But there is a problem for non-text items. While you can protect them from deletion and resizing, (if paragraphs are not protected) you cannot protect from insertion content before or after non-text items.
PS: the simplest way to apply changes in text and paragraph styles is ApplyStyleConversion + OnStyleConversion, and ApplyParaStyleConversion + OnParaStyleConversion, see the demos in TRichView\Demos\*\Editors\Editor 2, or a similar demo in ScaleRichView\Demos\*\RVDemos\Editors\Editor 2\
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: block edit after print
By the way, if you use incremental printing feature, and want to allow to enter text to the end of the last line, it may be not good.
Obviously, you cannot use it for centered, right-aligned and distributed paragraphs (if the last line is distributed as well), because new text in the last line will shift the text.
But even for left-aligned text, new text can change line breaking.
For example, text before printing.
Obviously, you cannot use it for centered, right-aligned and distributed paragraphs (if the last line is distributed as well), because new text in the last line will shift the text.
But even for left-aligned text, new text can change line breaking.
For example, text before printing.
Then the user added text:Hello world
You can see, "world" was moved to the next line.Hello worldwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
Re: block edit after print
I implemented the lock using: ProtectionOptions = [rvprModifyProtect, rvprDeleteProtect, rvprStyleProtect, rvprDoNotAutoSwitch, rvprStickToTop,rvprSticking];
but control + enter is still able to disorganize the text, any idea how to block control + enter?
thanks
but control + enter is still able to disorganize the text, any idea how to block control + enter?
thanks
Re: block edit after print
Else, how can I test if there are protected passages in the text?
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: block edit after print
Use one more text protection option, rvprParaStartProtect, it protects from Enter.
There are no visual differences in protected text. You can use TRVStyle.OnDrawStyleText to modify text drawing, if its protection is not empty. For example, you can draw a border around it.
For TSRichViewEdit, assign this event manually in code (SRichViewEdit1.RichViewEdit.Style.OnDrawStyleText)
There are no visual differences in protected text. You can use TRVStyle.OnDrawStyleText to modify text drawing, if its protection is not empty. For example, you can draw a border around it.
For TSRichViewEdit, assign this event manually in code (SRichViewEdit1.RichViewEdit.Style.OnDrawStyleText)
Re: block edit after print
the protection works when I send protection, so I save the text and when I reload "rvprParaStartProtect" it stops working, the text can be broken with enter at the beginning, what could I be doing to get around this?
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: block edit after print
In which format do you save?
These protection options can be stored only in RVF format.
These protection options can be stored only in RVF format.
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: block edit after print
Unfortunately, these protection options cannot be saved in RTF