Inserting text into a rich edit

Inserting text into a rich edit

Post by William Payn » Sat, 10 Jun 2000 04:00:00



Hello, I need to create a function that inserts a given text string
into a richedit control. How do I do that? I don't want to add it to
the clipboard, because that will overwrite what's already there. Is
doing a loop and sending the msg WM_CHAR for each char the only way to
accomplish this, or are there neater ways?

thanks

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Inserting text into a rich edit

Post by Nicolas Blanc » Sat, 10 Jun 2000 04:00:00



Quote:> Hello, I need to create a function that inserts a given text string
> into a richedit control. How do I do that? I don't want to add it to
> the clipboard, because that will overwrite what's already there. Is
> doing a loop and sending the msg WM_CHAR for each char the only way to
> accomplish this, or are there neater ways?

Set the current selection at the insertion point by sending a EM_SETSEL
window message to the richedit control. Don't forget to provide identical
values for the starting and the ending positions.

Then, insert the text by sending EM_SETTEXTEX.

 
 
 

Inserting text into a rich edit

Post by David A. Mai » Sat, 10 Jun 2000 04:00:00


On Fri, 09 Jun 2000 13:16:26 GMT, William Payne


>Hello, I need to create a function that inserts a given text string
>into a richedit control. How do I do that? I don't want to add it to
>the clipboard, because that will overwrite what's already there. Is
>doing a loop and sending the msg WM_CHAR for each char the only way to
>accomplish this, or are there neater ways?

Have you looked at the documentation to see what messages the rich
edit control suports.  I can't be bothered getting my MSDN library
disk 2 to find out myself, but it might be like other controls (e.g.
listboxes) and have messages for specialised functionality for some of
what you need.

Regards,
David.

------------------------------------------------------
In order to avoid the harassment of spam I have
deliberately included an invalid e-mail address in
this message.  To contact me by mail remove the not.

should note that due to the quantity of mail I receive
I may not answer and I am more likely to respond to
follow-up messages.
------------------------------------------------------

 
 
 

1. Rich Edit/EM_FORMATRANGE Q: Need way to determine width of painted rich text

Hi,

I am developing a WYSIWYG application that needs to paint rich text to
the screen and printer.  The application does its own formatting of
the text using some app defined control characters that we extract and
parse out.

The question is, how do we determine the width of a segment of text
that we want to paint using EM_FORMATRANGE? We need this information
because we want to determine the painted widths of certain sections of
text so we can perform our own text and field alignment.

What is documented in the Win32 help file is that sending the
EM_FORMATRANGE message with wParam = 0 causes the extent of the text
that is being painted (passed in the FORMATRANGE structure as 'chrg')
to be returned in the RECT  structure 'rc'. It is implied that
rc.Bottom and rc.Right will be updated on return.

What I observe is that only the height (rc.Bottom) is modified on
return. The value of rc.Right is unaffected.

I don't see any other candidate for doing this in the API.

So, does anyone know how to obtain the 'width' extent of painted rich
text? I would be most grateful for some ideas....

Thanks,

Don

2. Compact Flash Card Reader

3. How do i underline the selected text in a rich edit text box?

4. Subject: MegaSTE <<====>>

5. Rich edit controls and inserting OLE objects

6. urgent translation

7. How to get rich edit text size?Thanks.

8. WANTED: ARCSERVE 6.5, Database Agents, and Legato Software

9. Rich Text Edit Control (RICHED32.DLL)

10. rich text edit in browser as a ActiveX Control

11. How to detect text under mouse in rich edit control.

12. Rich Edit Text Bullet

13. Rich Text Edit Control -- Performance problems