Text editor example

Share your advanced PureBasic knowledge/code with the community.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

I have noticed the stream i/o routine you're using differs slightly from the one I use, but i haven't had a chance to determine exactly what the differences are yet.

Did the one you were using just not work or were there some positive symptoms I could lok for?

cheers
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

Youre welcome, Amundo. @rsts, it seems to read in the text in blocks, and then overwrite the last one or two
characters in the previous block with the first character in the next block. Something like that.

It could also be that it adds a character or two with each block. Anyways, I started to notice misplaced
characters with regular intervals after loading some larger textfiles, so I replaced them with 'regular' code
instead.

Since you've noticed differences I'm starting to think I did something wrong when translating these particular
procedures from PB 3.94 to 4.00.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

The code I'm using was PB 4 ready and was based on freaks work.

It's the updates by srod and Joakim near the end of this post

http://www.purebasic.fr/english/viewtop ... 6&start=15

I haven't noticed any dropped characters, but I've not tested it extensively. I'll do some more testing today.

cheers
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

I just put the stream io back, and found no problems at all! It loaded a testfile with more than 140 000
lines of text almost instantly, and nothing messed up :? so I think these procedures are ok after all.
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

Sugestion: make a procedure for the repeating routine after the #FILE_RECENTX events for better readability.

Nice work! :)
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

Sugestion: make a procedure for the repeating routine after the #FILE_RECENTX events for better readability.
I agree, that part of the code is rather embarrasing :oops: I'll probably change it :)
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

utopiomania wrote:I agree, that part of the code is rather embarrasing :oops: I'll probably change it :)
Your code looks great. Keep up the good work. ;)
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

I been using the heck out of this thing. :)
User avatar
waffle
Enthusiast
Enthusiast
Posts: 129
Joined: Mon May 12, 2003 1:34 pm
Location: USA
Contact:

Post by waffle »

I was working on a project, and you guys helped me without kowing it....

First, was my "self-learning project" which was a text editor like yours...
http://archonrpg.com/zips/textpad.zip

the only important dif is the use of colored text .....
Also, I replaced some of my code with yours when yours was better.
Your find/replace code was awsome. And your about box was better
than my messagerequester .....

Then, I applied what I learned to ....
http://archonrpg.com/zips/mypad.zip
which is a simple HTML editor (MDI app)
with included browser and customizable HTML tags ......

source is included with both zips .....
I was going to do a sep post for this, but 1 post about a text editor is enough. I just love PB because of all the help here.
And wanted to say thank you for the code.
Code is good... Its an international language.
Brice Manuel

Post by Brice Manuel »

waffle wrote:I just love PB because of all the help here.
And wanted to say thank you for the code.
I agree! The help here is invaluable!

On another note, oh great waffled one, I love your site! Some of the screenshots there are very interesting!
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

waffle, dont't hesitate to post your excellent code in your own thread. It will probably make samples more visible to newbies searcing the forums for code.
BTW, thanks for the nice words.. :oops:
Post Reply