Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Example Text Editor For DBC/DBP

Author
Message
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 7th May 2006 20:38
This program works OK, but is not a complete finished program. It was intended to be a very simple example to demonstrate how to make a simple text editor in DB Classic. (It also seems to work fine in DBP too).

It has been written simply to make it as easy to follow as possible, so it's not meant to be an exemplary example of optimized code.

Feel free to modify and use in your own programs as you wish.

Supports:

Text entry, Enter key, Backspace key, Cursor keys, Home key, End key.

Ctrl-S - Save surrent text file (overwrites if already exists)
Ctrl-L - Load text file (must know the name)
Ctrl-C - Clear current text
Ctrl-X - Exit

Current number of lines in the text file is displayed on the menu bar, along with the current row and column position of the cursor.

Note: You may have to alter the Sleep values if keypresses are repeated or not recorded when you type. In a more refined version, all the sleep commands would be replaced with a better timing function, but that's for you to do yourself...



TDK_Man

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 8th May 2006 00:05
That's great. Works really well.

Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 8th May 2006 00:15
I found a bug: If you press backspace if nothing stands: crash!

[/center]
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th May 2006 01:13
Quote: "I found a bug: If you press backspace if nothing stands: crash!"


Quite possible. It's just a part-working demo example to demonstrate how to do it.

A number of features need to be added - including error trapping. I didn't bother as I only really wanted to quickly demonstrate one method of how to make a text editor using string arrays.

Once the principle is understood, I assumed that people would use the method but with their own code - a bit more structured and optimised than mine, which was deliberatly kept simple to make it easier to follow.

TDK_Man

Login to post a reply

Server time is: 2024-11-23 07:38:03
Your offset time is: 2024-11-23 07:38:03