Page 1 of 2

Text editor example

Posted: Fri Mar 02, 2007 10:40 pm
by utopiomania
Here's a fairly complete (in my opinion) text editor which I use instead of Notepad and keep on a memory stick. It can
create shortcuts to itself, insert a file in a file, save a file to the end of another file, use Windows tools, Google your
selected text and so on..

It's a constantly changing thing which I wrote for my own use, and I post it as sample in case newbies to the PureBasic
language can use it to get some ideas :)

EDIT: There was a problem posting the source (1800 lines), so download it from the link in my post below.

Posted: Fri Mar 02, 2007 11:30 pm
by Joakim Christiansen
sorry, skip this post
No, just upload the source somewhere and share it with us :P

Posted: Fri Mar 02, 2007 11:44 pm
by Bonne_den_kule
You could had delete the whole thread before someone posted a reply :P

Posted: Sat Mar 03, 2007 12:02 am
by Joakim Christiansen
We wont let him get away!!

Posted: Sat Mar 03, 2007 12:08 pm
by SFSxOI
Great! I needed something just like this yesterday. Can you post the code somewhere for download?

Thank You :)

Posted: Sat Mar 03, 2007 12:30 pm
by utopiomania
Sorry for the mess :) , here it is: http://www.utopiomania.com/gate/onetext.zip

Posted: Sat Mar 03, 2007 12:39 pm
by Derek
One small problem, if I run the program and select clipboard from the edit or tools menu then I can no longer use the items in these menus, like the date picker etc, also the program won't close.

If I press ctrl+v then I get a message pasted into the text saying can't find clipbrd.exe and the same problems continue, I have to kill the program from inside the ide.

Posted: Sat Mar 03, 2007 1:13 pm
by utopiomania
I guess clipbrd.exe isn't installed on your system. Other than that, runProgram() just
ignores the command here if it can't find one of the tools?

If I change clipbrd.exe to for example clipbrd22.exe for the clipboard tool, the editor
just ignores the command without any problems, so I'm unshure of what I can do with this.

Posted: Sat Mar 03, 2007 3:48 pm
by Derek
Yeah, it's a bit strange because all the usual cutting and pasteing still works.

Posted: Sun Mar 04, 2007 8:58 pm
by utopiomania
Just uploaded an update. There seems to be a serious problem with the stream io
which I got from the forums, and I have a difficulty figuring out whats wrong with
it.

I imagine it is the reLoadSaveCallback() procedure and math when it loads chunks of
text, so I've replaced them with more down to earth code which is quite slower but
reliable.

Posted: Mon Mar 05, 2007 4:43 pm
by Rook Zimbabwe
I use METAPAD at times:

http://www.snapfiles.com/reviews/Metapad/metapad.html

And it is FREE...

Have also used:

http://www.snapfiles.com/get/context.html

and

http://www.snapfiles.com/get/inedita.html

The last one has line numbering and text highlighting... Used it as a C++ Editizer for a while.

Posted: Thu Mar 08, 2007 1:01 am
by utopiomania
Forgot to say, I posted an update yesterday regarding the switch from stream io to more basic means of loading
and saving text. (fixed a stupid problem :oops: )

However, the stream io is still in the source but rem'd out for the moment. I would like to put it back because it's
much faster though, and it handles .rtf as well, so if some of you have some spare time time on your hands, take
a look at it and see if you can spot the problem with it.

I'll try to fix it myself and post the code, but sometimes I feel I become blind by staring at the same spot for too
long, so any help is appreciated! :)

Posted: Tue Apr 03, 2007 2:48 pm
by rsts
Hi,

Just downloaded this and did a quick test. It looks great :D

Haven't had a chance to do an in-depth look yet, but I love what I see.

Will also take a look at the stream i/o, but since I use code from the forum, chances are, it shares the problem.

Once again, many thanks for posting.

cheers

Posted: Tue Apr 03, 2007 10:07 pm
by utopiomania
Your'e welcome. Many thanks for testing! About the stream i/o, the problem could also
be me doing some typing errors when formatting it, so.. But it can be fixed :)

Posted: Tue Apr 03, 2007 10:13 pm
by Amundo
Hi utopiomania,

This is neat, thanks for sharing your code.

(I've done my best to ignore Rook Zimbabwe's post).