Click to See Complete Forum and Search --> : Custum Edit Control Woes


beren
May 5th, 1999, 08:43 AM
Hia... I'm building a control up from scratch which resembels the CEdit-control, except that different parts of the text can be formatted differently at will. I.e, a certain portion of the text can be marked as a link, some of the text can be set bold, italic, another font, another font size or whatever the user requires. It's all saved in a tagged format in a HTML-like way.

Now, I've got it all parsed and put into CTextPart-objects which are stored in a CObList which I go through and call OnDraw with the pDC and rcBounds. This is where my problems reside:

1. How can I make a cursor like the one blinking in a normal text-editor?
2. I'm using OutText, but it doesn't seem to do react to neither newline-characters or line wrapping. How should I go ahead for supporting multiple lines?
3. When using multiple lines, how can I draw the entire virtual area so that I can support scroll-bars?
4. When having called OutText once, the rcBounds isn't updated, so that next time I call OutText (in the following CTextPart) the text is appended to the window. As is, it overwrites the entire thing.

And please, if I'm heading in the wrong direction, let me know! :)

Niklas

Paul McKenzie
May 5th, 1999, 10:18 AM
As far as the multiple line support, I'm not sure what OutText() is. I would use DrawText() instead. More options, and multi-line support is built in (it can be turned off with one of the options)

Regards,

Paul McKenzie

Rail Jon Rogut
May 5th, 1999, 12:28 PM
Why don't you just derive a class from CRichEditCtrl and add the functionality you need to that?

Rail

Recording Engineer/Software Developer
Rail Jon Rogut Software
railro@earthlink.net
http://home.earthlink.net/~railro/

beren
May 6th, 1999, 02:47 AM
As I said, I need to structurize my data with a preset markup language, and I need it to store the information in the same markup language. This is not like HTML where you have <BOLD> and such, but you can more think of it as a HTML-page where you use only id's which reffer to stylesheet-defined styles. Thus richtext is not what I want.

beren
May 6th, 1999, 02:58 AM
Thanks, I'll try using DrawText instead. I used outtext as I wanted to set fonts to my text, but I hope DrawText does the same.

However, do you know how I can append text to it when I've already written some text?? Do I need to recalculate the tagRECT? How can I recalculate this so that it will be aligned right with the rest of the text? And how should I make scrolling?

Sincerely yours

Niklas