Add Text To multiline textbox

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 2
Reputation: ChaosBG is an unknown quantity at this point 
Solved Threads: 0
ChaosBG ChaosBG is offline Offline
Newbie Poster

Add Text To multiline textbox

 
0
  #1
Oct 13th, 2009
Hey guys i've tryed to find how to do this the best way but it failed. So i want to ask the experts here:

How to add a new line of text to a edit control.
Example: I have alredy some text in the edibox and i want to add some text on the next line.

Thanks in advance:
~Cha0sBG
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 134
Reputation: Frederick2 has a spectacular aura about Frederick2 has a spectacular aura about Frederick2 has a spectacular aura about 
Solved Threads: 14
Frederick2 Frederick2 is offline Offline
Junior Poster
 
0
  #2
Oct 13th, 2009
The edit box has to be created with the appropriate style to act as a multi-line text box. Look up the styles - off the top of my head I just don't have them memorized. But if the right style wasn't used at creation time - it just ain't gonna ever be a multi-line edit box.

added later - from Api CreateWindow() docs...

ES_MULTILINE Designates a multiline edit control. The default is single-line edit control.

Here would be what a CreateWindowEx() call to create such an edit control would look like...

  1. hEdit=
  2. CreateWindowEx
  3. (
  4. WS_EX_CLIENTEDGE,
  5. "edit",
  6. "",
  7. WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL|ES_MULTILINE|WS_VSCROLL,
  8. 60,80,620,24,
  9. hWnd,
  10. (HMENU)IDC_EDIT,
  11. ghInst,
  12. 0
  13. );
Last edited by Frederick2; Oct 13th, 2009 at 12:04 pm. Reason: add cast
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: ChaosBG is an unknown quantity at this point 
Solved Threads: 0
ChaosBG ChaosBG is offline Offline
Newbie Poster
 
0
  #3
Oct 13th, 2009
I just need a way to add text to it but not the

  1. SetDlgItemText

~Cha0sBG
Last edited by ChaosBG; Oct 13th, 2009 at 11:56 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 134
Reputation: Frederick2 has a spectacular aura about Frederick2 has a spectacular aura about Frederick2 has a spectacular aura about 
Solved Threads: 14
Frederick2 Frederick2 is offline Offline
Junior Poster
 
0
  #4
Oct 13th, 2009
It wouldn't hurt to be clearer in your question then. To add additional text to a text box (multiline or otherwise), you need to retrieve the text already in the text box into a string variable/buffer within your program using GetWindowText() or some such, then concatenate your additional text onto it, then finally replace the entirety of the original text in the text box with the new.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 118
Reputation: marco93 is infamous around these parts marco93 is infamous around these parts marco93 is infamous around these parts 
Solved Threads: 12
marco93 marco93 is offline Offline
Junior Poster
 
-1
  #5
Oct 13th, 2009
Originally Posted by Frederick2 View Post
To add additional text to a text box (multiline or otherwise), you need to retrieve the text already in the text box into a string variable/buffer
No, you don't need to retrieve the text !
It's a very old Win16-Win32 FAQ, see (Win32 grp) with EM
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC