I have decided to tackle a good BASIC delopment environment so that I don''t need to type in the line number for programs for my SHARP Wizard organizer (if you don''t have one, you need one!). I have a really nice (well, not so nice, but it looks cool) text editor that MFC made for me, plus some of my own features. To implement the line-numbering feature, I need a way to access the text in my CEditView before it is serialized (so I can prepend the line number to every line...). How do I do this? I can''t see how it could be done, because it is serialized by a single call to a member function of CEditView! I know this can be done because there wouldn''t be any Microsoft Word without it. Does anyone know how (simple is better, btw )
--------------------
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
WARNING: The following has not been tested by me. Not responsible for loss of sleep, time, hair, etc.
I''m going to make a couple of assumptions, the first being that you''re triggering the serialize by doing something (be it a button, save option on a menu, whatever) so you can do something to the text before you call serialize, and the second being that there is some indication of where you want lines to break off, which is probably a \n.
Assuming that, I would suggest you do the following:
1) Set your cursor to the top of the edit box 2) Use OnReplaceSel to find the next occurrence of \n 3) Replace the \n with \n and the line number, incrementing the line number each time, of course
Make sure you stop when you reach the end of the edit view. Then do your serialize call.
This is of course assuming that it will let you do find and replaces on carriage return newlines.
If you care, you might make a buffer for the original un-numbered text to replace what''s in the edit box before doing this.
HTH, and HTW.
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
That is exactly what I want to do. I can''t do it because I don''t know how to get at the text in the edit view. It isn''t like a normal edit control where you can just call UpdateData() and have it read into a variable. If someone could tell me how to access the text in the view, that would be great.
--------------------
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
Well... actually... these calls are specifically for CEditView. I'm assuming that they work regardless of your ability to use UpdateData. I suppose that if you really really want the buffer itself or to access the embedded edit control to do edit control calls on it, you can use LockBuffer and GetEditCtrl respectively. I don't think you need an actual buffer handle to use the calls I suggested above, though.
-fel
Edited by - felisandria on December 29, 2000 3:04:45 AM
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~