Text Editor as a list control?
-
Hi, Still new to programming....kinda confused right now. I created a MFC app to create a standard text editor.(My base class is Ceditview) I wanted to know how i could have the editor have a set string of text on it as soon as it starts. Basically I want to make it look like a List Control window. Having strings of text passes into the editor window as a display listing. But I also want to allow for regular paragraphs to be passed in? Can this be done or is there a better solution? Thanks in advance.
-
Hi, Still new to programming....kinda confused right now. I created a MFC app to create a standard text editor.(My base class is Ceditview) I wanted to know how i could have the editor have a set string of text on it as soon as it starts. Basically I want to make it look like a List Control window. Having strings of text passes into the editor window as a display listing. But I also want to allow for regular paragraphs to be passed in? Can this be done or is there a better solution? Thanks in advance.
Use SetWindowText in OnCreate. Hard to suggest a better solution as I dont know what you want the user to do with the pre defined text. But one is to have a list control and an edit control. Magnus
-
Use SetWindowText in OnCreate. Hard to suggest a better solution as I dont know what you want the user to do with the pre defined text. But one is to have a list control and an edit control. Magnus
I would like to use the predefined text as a column heading. The only thing is that I will have a mixed form of the things that i want to put in the editor. For example:
Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 1 345 456 567 678 789 2 987 876 765 654 543 This is a line of code that will be inserted in the middle of my so called "table" of information. There is no defined length. This is all entered from another dialog box. 3 123 234 345 456 567 4 678 789 910 566 556
I hope this makes it a little easier for me to understand. I originally wanted to use a ListControl, but since i need to add that paragraph, i couldn't. Unless i can expand it across the columns. Thanks again in advance.
-
I would like to use the predefined text as a column heading. The only thing is that I will have a mixed form of the things that i want to put in the editor. For example:
Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 1 345 456 567 678 789 2 987 876 765 654 543 This is a line of code that will be inserted in the middle of my so called "table" of information. There is no defined length. This is all entered from another dialog box. 3 123 234 345 456 567 4 678 789 910 566 556
I hope this makes it a little easier for me to understand. I originally wanted to use a ListControl, but since i need to add that paragraph, i couldn't. Unless i can expand it across the columns. Thanks again in advance.
Then you have only the editbox, or Richedit if you want more formation options, as an option, unless you make it a little more advanced and use a grid that has support for text over several columns. There is a really good grid on Codeproject, but I dont know if it supports text over several columns. Magnus
-
Then you have only the editbox, or Richedit if you want more formation options, as an option, unless you make it a little more advanced and use a grid that has support for text over several columns. There is a really good grid on Codeproject, but I dont know if it supports text over several columns. Magnus
Magnus, Thanks for your help. Can you tell me how I can do this though? I can't the predefined string to the editbox upon startup of the app. Can you or anyone tell me how to do that? How would I format this text? (something like setw() in a cout statement?) Thanks again.
-
Magnus, Thanks for your help. Can you tell me how I can do this though? I can't the predefined string to the editbox upon startup of the app. Can you or anyone tell me how to do that? How would I format this text? (something like setw() in a cout statement?) Thanks again.
Jay Hova wrote: How would I format this text? (something like setw() in a cout statement?) Not unless you are working on a console application. Since you've mentioned the use of an edit control and a list control, you are obviously not working on a console application, but rather a GUI application. Send formatted text to either using a CString object. It has a nice Format() method. Here's a very simple example:
void CMyEditView::OnInitialUpdate()
{
CEditView::OnInitialUpdate();CEdit &Edit = GetEditCtrl(); Edit.SetWindowText("Hello World"); // if you want some formatted text, use this instead CString str; str.Format("2 \* 2 = %d", 2 \* 2); Edit.SetWindowText(str);
}