![]() |
PBASIC Editor Question
Does anyone know how the editor inserts a stamp directive at a specified line w/o deleting all the other text?
If so, can you please tell me how? [Credit will be given] |
Depends on what language/API you're trying to do it in. For example, to insert the text stored in the CString object newText into line 2 of a CEdit object named m_big, the code would be:
int i=m_big.LineLength(0)+2; m_big.SetSel(i, i); m_big.ReplaceSel(newText + "\r\n"); The +2 is there so that it includes the the \r\n sequence at the end of every line. The SetSel function will set the current selection, but since the start and end values are the same, it merely moves the insertion point. ReplaceSel will either replace the currently selected text or insert the text at the current insertion point if there is no current selection. [edit] Please don't worry about "credit" for this. As long as you learn the stuff and write your own code, you really don't need to credit people. Think of it like learning out of a book--you don't credit the author unless you copy specific portions of code directly from the book. [/edit] |
1 Attachment(s)
Oops! Forgot to upload the quick-and-dirty sample app I put together in the last 5min. Here it is (source and exe provided):
|
Rob -- Thanks.
Got anything for the Win32? Sorry, forgot to mention this. If the code works for Win32, cool. >> EDIT: << : About the credit, and this is sorta off-topic, but if I use the code you use in RoboGUI or RoboEmu, to connect to a COM Port, I'd give you credit then, right? [Sorry, but what you said about giving credit, and my thought on it is totally different...and reading the GNU GPL doesn't clear it up all that much either] |
Quote:
Code:
int i=SendDlgItemMessage(hDlg, ID_OF_TEXT_BOX, EM_LINELENGTH, 0, 0) + 2;Quote:
|
Quote:
That would also get the send line, right? Ok, thanks for clearing up the credit thing. |
Here's my project so far if anyone wants it.
|
| All times are GMT -5. The time now is 00:29. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi