Go to Post "Splet" is the sound a frog makes when it hits pavement at 187 feet per second. Don't ask me how I know. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-08-2003, 11:47
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
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]
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #2   Spotlight this post!  
Unread 12-08-2003, 12:20
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
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]
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 12-08-2003, 12:26
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Oops! Forgot to upload the quick-and-dirty sample app I put together in the last 5min. Here it is (source and exe provided):
Attached Files
File Type: zip inserttest.zip (29.8 KB, 29 views)
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #4   Spotlight this post!  
Unread 12-08-2003, 12:27
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
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]
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"

Last edited by Raven_Writer : 12-08-2003 at 12:34.
  #5   Spotlight this post!  
Unread 12-08-2003, 12:47
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Quote:
Originally posted by Raven_Writer
Rob -- Thanks.

Got anything for the Win32?
The concepts are identical, it's just the way you call the functions that are different. Instead, it would be:

Code:
int i=SendDlgItemMessage(hDlg, ID_OF_TEXT_BOX, EM_LINELENGTH, 0, 0) + 2;
//the first zero above is the line number to retrieve.  The second one should always stay 0.

SendDlgItemMessage(hDlg, ID_OF_TEXT_BOX, EM_SETSEL, i, i);

SendDlgItemMessage(hDlg, ID_OF_TEXT_BOX, EM_REPLACESEL, TRUE, szNewText);

Quote:

>> 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?
If you use the exact code, then yes. If you just use concepts, then no. For example, if you read my serial port whitepaper and directly copy-paste the code, then you would need to give me credit. On the other hand, if you write all your own code using just the ideas in the paper, then you don't. If it wasn't this way, every single program I've ever written would have to have probably close to a hundred credits, since it would have to include every book, professor, or internet article I've ever read/talked with about everything from C++ to MFC to graphics to programming methodology.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #6   Spotlight this post!  
Unread 12-08-2003, 12:52
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Quote:
Originally posted by rbayer
The concepts are identical, it's just the way you call the functions that are different. Instead, it would be:

Code:
int i=SendDlgItemMessage(hDlg, ID_OF_TEXT_BOX, EM_LINELENGTH, 0, 0) + 2;
//the first zero above is the line number to retrieve.  The second one should always stay 0.

SendDlgItemMessage(hDlg, ID_OF_TEXT_BOX, EM_SETSEL, i, i);

SendDlgItemMessage(hDlg, ID_OF_TEXT_BOX, EM_REPLACESEL, TRUE, szNewText);



If you use the exact code, then yes. If you just use concepts, then no. For example, if you read my serial port whitepaper and directly copy-paste the code, then you would need to give me credit. On the other hand, if you write all your own code using just the ideas in the paper, then you don't. If it wasn't this way, every single program I've ever written would have to have probably close to a hundred credits, since it would have to include every book, professor, or internet article I've ever read/talked with about everything from C++ to MFC to graphics to programming methodology.
Ok, for the DlgItem stuff, hDlg would be HWND hDlg (but would you have to use this for the edit box or anything, or is it just like a buffer)?

That would also get the send line, right?

Ok, thanks for clearing up the credit thing.
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
  #7   Spotlight this post!  
Unread 12-08-2003, 13:38
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Here's my project so far if anyone wants it.
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PBASIC ARCTAN function Greg Ross Programming 14 11-05-2003 12:28
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
RoboEmu 1.09 (supports PBASIC 2.5) rbayer Programming 22 21-01-2003 17:22
PBASIC Loop Speed? archiver 2001 3 23-06-2002 23:46


All times are GMT -5. The time now is 19:51.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi