Ok this is a fact finding mission :) . Rather than mirror the the messages of Richedit, i would like to know what messages you'd like to have (if you wanted to us a custom edit control).

ie) (Copy this for template if you would like)
NEM_xxxx = Nan Edit Message (original eh? ;) )

TITLE : Delete Line
wParam : LineNumber
lParam : NULL
return : True on Error, else False

I really dont like or know alot of the Richedit messages, so rather than decipher what i think are good messages to suport, i thought i would let those of you who have *wished* for better messages to speak up. I will try and suport all messages sugested, but no promises ;)

Posted on 2002-05-07 13:57:47 by NaN
i like the NEM_xxxx part, some of my friends call me that (but with out the _xxx thing) :grin:
Posted on 2002-05-07 14:32:34 by NEMO
I recently (6 mo ago) had to bend a RichEdit control to my (nefarious) will, and these are from the methods I had to add to make it work comfortably for me. Note that some of these are direct overlays of RichEdit functions, other merely use the rich edit functionality.

SetSelColor - Sets the text color of the current selection only.
Takes a COLORREF, returns True on Error (e.g. nothing selected),
else False

SetTextColor - Sets the default text color of the control.
Takes a COLORREF, returns nothing. (It shouldn't fail.)

GetTextColor, GetSelColor - return the appropriate COLORREF.

GetLineLength, GetLineText - query a line in the control
GetTextLength, GetText - query the text of the entire control
as a single string of TCHARS.
ReplaceLine - Takes a line number and new text. Replaces the
chars from BOL to EOL with inserted text; if you leave off the \r\n
it merges with the next line, if you replace with NULL it deletes
the line.

ReplaceSel - Takes text to insert, replaces the current selection
with it.

GetBOL, GetEOL - takes a line number, returns the char position
in the caret at the beginning/end of the line.

MoveCursor - Essentially a SetSel with a length of 0.

ScrollLines - Takes a number of lines n. Scrolls the text n lines
up/back(n<0) or down/forward (n>0)
IsLineVisible - Returns true if line n is currently visible in the
viewport of the control.
GetFirstVisibleLine, GetLastVisibleLine - returns the line indices as
char positions
[i]alternately: GetFirstVisibleLine, GetVisibleLineCount.[/i]

LineFromChar - returns the line number of a char position
GetLinePos - returns the char pos of the beginning of requested

Some of these may not be useful from a general purpose standpoint (I was writing a VT-100 emulator). The following functions are very likely to be too specialized to help, but I thought I'd mention them anyway :-)

CropLines - Wrapper for DeleteLine/ReplaceSel. My terminal
needs to scrap old lines in batches, so it might help if they could
be cropped all at once for efficiency--especially since deleting from
the head of a vector is very costly.

AppendText - Appends a string to the end of the control and calls
EM_SCROLLCARET to ensure that the text is in view.
AppendMessage - Identical to AppendText, but also adds a \r\n
to the string.
GetLastLine - Returned the string on the last line (on a terminal,
this is the line with the prompt on it; the rest of the control was
programatically kept read-only to enforce the terminal metaphor).

GetRichEditStats - Hmm, now this one might actually be useful. I
found myself requesting and using the same handful of data
members over and over, so I collected them into a structure.

Pardon my MFC:

typedef struct tagRichEditStats {
CPoint Cursor; // 0-based line,char position of cursor.
long iLineStart; // Character position of the beginning of the current line.
long iLineCount; // Number of lines in edit control.
long iLineLen; // Length of current line in characters
long iStartSel; // Selection beginning
long iEndSel; // Selection end
} RichEditStats;

Anyway, enough blathering. Good luck!


You can't please everyone. Concentrate on me.
Posted on 2002-05-07 16:06:09 by Chalain
Thanx for your suggestions, i will try me best ;)
Posted on 2002-05-08 18:23:56 by NaN
I shouldn't need to explain why this is an absolute necessity.

On a more serious note, I also think it'd be really cool if you'd give it some console-ish attributes. i.e. give the option to hook it into stdout and stdin.
Posted on 2002-05-08 18:30:46 by iblis

Ok, i will see what i can do. If i can do this, i will name the message NEM_SETMORONDORKMODE just for you ;) (and i will equate it to another message that is more appropriate)

Posted on 2002-05-09 03:21:37 by NaN
Woohoo! :alright:
Posted on 2002-05-09 14:06:19 by iblis