howto put non-editable in a textctrl

Hello,

I'm looking for an easy way to put non editable text in a text
control.

Something like this:
"""Lorem ipsum dolor sit amet, consectetur [non-editable text]
adipisicing elit, sed do eiusmod tempor incididunt"""
Where the user cannot modify "[non-editable text]".

The control should be multi-line.
Optionally the user might not even delete the non-editable text, or
may move it around using the clipboard (ctrl+x, ctrl+v).
Worst case the [non-editable text] can be an image with the text
rendered. I checked RichTextCtrl but using the clipboard breaks havos,
images are not pasted.

Thanks for any help or pointers.

···

--
Best regards,
Adam mailto:agroszer@gmail.com

Using a wx.TextCtrl...

Option 1: Capture all key events, character insertions, and text events.
Use .Skip() or not to allow the modification or not.

Option 2: Override CanCut, CanCopy, and CanPaste to take the cursor
position into account.

Option 3: Capture wx.EVT_KEY_DOWN, call SetEditable() based on the
cursor position.

Related: Create your own text drop target, offer feedback based on the
position of the possible drop.

Personally, I would go with option 3, though it is going to be tricky
keeping track of the "not ok to edit" data ranges.

- Josiah

···

Adam Groszer <agroszer@gmail.com> wrote:

Hello,

I'm looking for an easy way to put non editable text in a text
control.

Something like this:
"""Lorem ipsum dolor sit amet, consectetur [non-editable text]
adipisicing elit, sed do eiusmod tempor incididunt"""
Where the user cannot modify "[non-editable text]".

The control should be multi-line.
Optionally the user might not even delete the non-editable text, or
may move it around using the clipboard (ctrl+x, ctrl+v).
Worst case the [non-editable text] can be an image with the text
rendered. I checked RichTextCtrl but using the clipboard breaks havos,
images are not pasted.

Thanks for any help or pointers.

I know that Dabo's dEditBox has a ReadOnly property that prevents the
control's contents from being modified, but I'm not sure about not
being able to copy it. Looking at the source code, they're calling the
control's SetEditable() method to achieve this. You might want to try
that method to see if it does what you need.

···

On 3/27/07, Adam Groszer <agroszer@gmail.com> wrote:

I'm looking for an easy way to put non editable text in a text
control.

Something like this:
"""Lorem ipsum dolor sit amet, consectetur [non-editable text]
adipisicing elit, sed do eiusmod tempor incididunt"""
Where the user cannot modify "[non-editable text]".

The control should be multi-line.
Optionally the user might not even delete the non-editable text, or
may move it around using the clipboard (ctrl+x, ctrl+v).
Worst case the [non-editable text] can be an image with the text
rendered. I checked RichTextCtrl but using the clipboard breaks havos,
images are not pasted.

--

# p.d.

Hello Josiah,

Option 3 is cool. Keeping the non-editable range would be piece of
cake in the background color -- white: editable, gray: non-editable.

The small problem is, that attributes do not get copied through the
clipboard, just the plain text. So if the non-editable part is
moved/copied around in the text, the background--the non-editable
attribute is lost.

Any ideas for that? Custom clipboard handler if that's possible?

Tuesday, March 27, 2007, 9:43:55 AM, you wrote:

···

Adam Groszer <agroszer@gmail.com> wrote:

Hello,

I'm looking for an easy way to put non editable text in a text
control.

Something like this:
"""Lorem ipsum dolor sit amet, consectetur [non-editable text]
adipisicing elit, sed do eiusmod tempor incididunt"""
Where the user cannot modify "[non-editable text]".

The control should be multi-line.
Optionally the user might not even delete the non-editable text, or
may move it around using the clipboard (ctrl+x, ctrl+v).
Worst case the [non-editable text] can be an image with the text
rendered. I checked RichTextCtrl but using the clipboard breaks havos,
images are not pasted.

Thanks for any help or pointers.

Using a wx.TextCtrl...

Option 1: Capture all key events, character insertions, and text events.
Use .Skip() or not to allow the modification or not.

Option 2: Override CanCut, CanCopy, and CanPaste to take the cursor
position into account.

Option 3: Capture wx.EVT_KEY_DOWN, call SetEditable() based on the
cursor position.

Related: Create your own text drop target, offer feedback based on the
position of the possible drop.

Personally, I would go with option 3, though it is going to be tricky
keeping track of the "not ok to edit" data ranges.

- Josiah

--
Best regards,
Adam mailto:agroszer@gmail.com

Hello Josiah,

It works almost fine. My last problem is that wx.TextDropTarget seems
not to work with wxTE_RICH2.
I'd be fine if I could disable DnD entirely for the control.
Any ideas?

thanks

Tuesday, March 27, 2007, 9:43:55 AM, you wrote:

···

Adam Groszer <agroszer@gmail.com> wrote:

Hello,

I'm looking for an easy way to put non editable text in a text
control.

Something like this:
"""Lorem ipsum dolor sit amet, consectetur [non-editable text]
adipisicing elit, sed do eiusmod tempor incididunt"""
Where the user cannot modify "[non-editable text]".

The control should be multi-line.
Optionally the user might not even delete the non-editable text, or
may move it around using the clipboard (ctrl+x, ctrl+v).
Worst case the [non-editable text] can be an image with the text
rendered. I checked RichTextCtrl but using the clipboard breaks havos,
images are not pasted.

Thanks for any help or pointers.

Using a wx.TextCtrl...

Option 1: Capture all key events, character insertions, and text events.
Use .Skip() or not to allow the modification or not.

Option 2: Override CanCut, CanCopy, and CanPaste to take the cursor
position into account.

Option 3: Capture wx.EVT_KEY_DOWN, call SetEditable() based on the
cursor position.

Related: Create your own text drop target, offer feedback based on the
position of the possible drop.

Personally, I would go with option 3, though it is going to be tricky
keeping track of the "not ok to edit" data ranges.

- Josiah

--
Best regards,
Adam mailto:agroszer@gmail.com