List Info

Thread: Re howto put non-editable in a textctrl




Re howto put non-editable in a textctrl
user name
2007-03-30 11:47:00
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 <agroszergmail.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:agroszergmail.com


------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


Re: howto put non-editable in a textctrl
user name
2007-03-30 16:30:07
Create your own drag and drop target, make it reject any
drop events. 
(there are example drop targets in the demo)  For dragging
out, you can
handle wx.EVT_LEFT_DOWN, wx.EVT_LEFT_UP, and wx.EVT_MOTION
to select
text rather than drag it.

 - Josiah

Adam Groszer <agroszergmail.com> wrote:
> 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 <agroszergmail.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:agroszergmail.com


------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )