Text editor example

Share your advanced PureBasic knowledge/code with the community.
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Text editor example

Post 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.
Last edited by utopiomania on Sat Mar 03, 2007 12:34 pm, edited 2 times in total.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

sorry, skip this post
No, just upload the source somewhere and share it with us :P
I like logic, hence I dislike humans but love computers.
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

You could had delete the whole thread before someone posted a reply :P
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

We wont let him get away!!
I like logic, hence I dislike humans but love computers.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Great! I needed something just like this yesterday. Can you post the code somewhere for download?

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

Post by utopiomania »

Sorry for the mess :) , here it is: http://www.utopiomania.com/gate/onetext.zip
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post 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.
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post 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.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Yeah, it's a bit strange because all the usual cutting and pasteing still works.
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post 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.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post 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.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post 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! :)
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post 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
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post 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 :)
Amundo
Enthusiast
Enthusiast
Posts: 200
Joined: Thu Feb 16, 2006 1:41 am
Location: New Zealand

Post by Amundo »

Hi utopiomania,

This is neat, thanks for sharing your code.

(I've done my best to ignore Rook Zimbabwe's post).
Win10, PB6.x, okayish CPU, onboard video card, fuzzy monitor (or is that my eyesight?)
"When the facts change, I change my mind" - John Maynard Keynes
Post Reply