A completely different approach would be to use two STCs.
A read-only on the top, and a read-write at the bottom. Could
it be possible to place them seamlessly next to each other without
any border, and make the scrolling etc behave as expected? Moving
text from the lower to the upper STC shouldn't be difficult.
At least that seems like an impenetrable solution regarding
read-only if it works.
Maybe it's not even such a bad idea if there is a visible edge
between them. They are after all different thingies, the editing
area and the history area. The thing I imagine gets difficult is
a selection of text in both the read-only and read-write area at
the same time. But maybe one could live with that?
/Magnus
···
At 16:51 2001-10-23 -0500, you wrote:
I see. Yikes! Hadn't even thought about all those. Ouch. I'm in a world of
hurt now. I noticed something in the Scintilla docs about a read-only switch
thingie. Is that something I could toggle based on the cursor position? I
know I'm being a pest but I really want a simple solution. I just want to
extend and modify Scintilla as little as possible. I don't want to have to
recreate the wheel. Thanks.
--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se
An interesting idea, but I think it needs to be one control. And I think I'm
close to having the behavior I want.
···
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Magnus Lyckå
Sent: Tuesday, October 23, 2001 5:41 PM
To: wxpython-users@lists.wxwindows.org
Subject: RE: [wxPython] Capturing Cut/Copy/Paste in wxSTC
A completely different approach would be to use two STCs.
A read-only on the top, and a read-write at the bottom. Could
it be possible to place them seamlessly next to each other without
any border, and make the scrolling etc behave as expected? Moving
text from the lower to the upper STC shouldn't be difficult.
At least that seems like an impenetrable solution regarding
read-only if it works.
Maybe it's not even such a bad idea if there is a visible edge
between them. They are after all different thingies, the editing
area and the history area. The thing I imagine gets difficult is
a selection of text in both the read-only and read-write area at
the same time. But maybe one could live with that?
/Magnus
--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se
Another way to handle this is to set Scintilla to read-only and then
respond to the ModifyAttemptRO notification by changing the state to
read-write if the selection is safe. A feature could be added to make a
temporary change to allow modification just for the current event.
Neil
That last change to my OnKeyDown handler got me everything I wanted, and a
little bit more. Now it even blocks copying in the read-only zone. So I just
need to allow Ctrl-C to succeed and I think I'm pretty well set. (And I can
defer any issues about the keybindings until I tackle the issue of how to
let the user configure those.)
Your idea is intriguing, but it would probably require me to refactor more
than I'm prepared to at the moment. Especially if I have everything working.
But thanks for helping me think through these issues.
···
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Neil Hodgson
Sent: Tuesday, October 23, 2001 6:22 PM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Capturing Cut/Copy/Paste in wxSTC
Another way to handle this is to set Scintilla to read-only and then
respond to the ModifyAttemptRO notification by changing the state to
read-write if the selection is safe. A feature could be added to make a
temporary change to allow modification just for the current event.
Neil
Well, I really only meant clipboard-based operations when I said
"everything." <wink> In any case, I think the latest modifications to my
OnKeyDown handler have solved all my problems. The version of PyCrust now in
CVS seems to work the way I wanted. Except for the drag and drop operations,
that is, but I'll wait for your enhancements and then that should be it.
Unless you know some other way to delete text from a wxSTC without passing
through one of my methods?
···
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."
-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Robin Dunn
Sent: Tuesday, October 23, 2001 4:39 PM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Capturing Cut/Copy/Paste in wxSTC
Wouldn't it make more sense for Scintilla to always route everything
through
its Cut, Copy and Paste methods? Then subclasses could override the
default
behavior without concern for how these events are triggered.
No, because not everything is a Cut, Copy, or Paste, (IOW, involve the
clipboard.) Secondly it would increase the complexity of the wrappers to
allow non-event-based callbacks.
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!