Streaming data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've heard the phrase "streaming data into a rich text box" and I want to
know whether it means what I hope it means.

What I hope it means, is that if the user pastes a whole load of text into
the rich text box at once, such as a whole paragraph, a normal combobox would
only get change event / message for the whole lot of text. What I want is a
way for it to get one per each character, or some bastardization of such,
hence the text 'streams' into it, one character at a a time.

Does it? If not, what? If so, how do I do it?
 
Patty said:
I've heard the phrase "streaming data into a rich text box" and I want to
know whether it means what I hope it means.

See the EM_STREAMIN and EM_STREAMOUT messages.
What I hope it means, is that if the user pastes a whole load of text into
the rich text box at once, such as a whole paragraph, a normal combobox would
only get change event / message for the whole lot of text. What I want is a
way for it to get one per each character, or some bastardization of such,
hence the text 'streams' into it, one character at a a time.

Does it? If not, what? If so, how do I do it?

Pasting into a richedit control does not involve the streaming messages. I
don't know of any standard way to get the per-character notifications you're
after. Perhaps you could intercept WM_PASTE and stream the clipboard into
the control. Or, maybe IRichEditOleCallback::QueryAcceptData would be
useful. Or, maybe you could record the current selection endpoints and
content length, perform the paste, and calculate the length of the pasted
text something like this:

new_end_pos = old_end_pos + (new_length - old_length);

Then [start_pos, new_end_pos) should give the range of the pasted text,
which you could go on to examine or process, though the control may have
already drawn itself by this time.
 
Back
Top