I've already searched the Web and Deja.com, but I've found no answer.
I have two questions about TRichEdit:
1. The OnSelectionChange Event. This event fires twice. Anyone knows
what's causing the second firing of the event?
2. The OnMouseUp Event never fires.
I can easily solve question #1 - AFAI could see, it consistently fires
twice every time, so a flag should do the trick, I guess. I would like
to understand why it's happening, though. Yes, I know... too curious for
my own good :)
OTOH, question #2 has eluded me completely. The problem seems to be with
TCustomRichEdit, because TMemo - which, like TCustomRichEdit, inherits
from TCustomMemo - handles the OnMouseUp Event correctly.
Any ideas, pointers, etc?
TIA!
--
Suravye ninto manshima taishite
Paulo Caetano
Please, remove "_your_mask_" to answer by e-mail
"And in the end the love you take is equal to the love you make"
Lennon & McCartney
It only fires twice when you click in the control, if you move the caret
using the keyboard to select it it will fire once per character the
selection grows or shrinks by. If you drag the mouse to select text the
event fires twice when you let go of the mouse, same as if you click. MS
may have had a reason for doing it this way but it is hidded to us mere
mortals <g>.
> 2. The OnMouseUp Event never fires.
That is not quite true, it fires if you mouse down on selected text and
then let go. This seems to be a side effect of the ability to drag text
around in the control (it natively supports OLE drag and drop).
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
I'm trying to do a chord file editor, and I want to allow the user to
select a note and a chord type on a toolbox, and insert it in the rich
edit (I'm using a rich edit because I've learned by experience that the
chords should be in bold).
The user would select the chord, click+ctrl on the rich edit, et voila!
The app inserts the chord. I will use OnMouseDown if I have to, but the
"right thing" seems to be OnMouseUp; it would work like a click on a
button, in that the button doesn't do anything if you don't until you
release the mouse button.
Any suggestion would be welcome :)
Thanks again!
Well, now that you mention it... :)
I was considering what would be the "most productive" way of doing it.
To me, it's definitely selecting a chord, and "pasting" all its
instances on the file (similar to the Delphi IDE, when you Shift+click a
component). However, your combination of keyboard to move the caret and
mouse to insert the chord is a great option, too. Back to the drawing
board to find out a way to implement both; hopefully, a way that's not
confusing.
Yesterday I came across a wonderful component library called RXLib. I'm
using its RichEdit component. It handles the MouseUp event in a
predictable manner, although its SelectionChanged isn't so predictable.
Thank you, Peter.