This is the follow up to the "Gutter Custom Control" thread started in the "General Questions" section.
Thought it would make sense to move here for updates to the text editor i'm working on.
Up to that point, i had mitigate succes in implementing the "Find/Replace" common dialog.
The "Find" function is working, the "Replace" function too. But i still have to write the
"Replace All" function and manage the "Whole word" option correctly. I disabled the "Search
Up" option to ease the whole thing a little bit.
This is a slightly improved version, far from finished. Anyway, i'm sharing the source.
See attached ZIP archive.
You don't seem to be using a resource (.rc) script for your images and icons. Is this by design, 'cos I am a bit lost with this! You are using resource-like names for images, etc, that have different names to what you are trying to load
All apologies, i actually forgot to join the ".rc" file.
Updated ZIP with needed file, see attachment in first post...
For those whom might be interested, i'm not compiling from a floppy disk :
"A:\" path in the resource file points to a RAM disk on my system.
Main advantage gained from compiling on a RAM disk is speed...
OK, that fixed the bitmaps and icons problem, but I still can't get it to open an actual file!
Oops ! "Unexpected bug !"
You're absoluteky right.
Something messed up in the 'DoOpen()' subroutine :
' Open file
IF fName = "" THEN fName = FileRequest("Open File",WIN,1,Filter$,"txt")
MESSAGEBOX(win,fName,"File", 0 | 80)
if(len(fName) > 0)
buffer = ""
if(openfile(fHdl,fName,"R") = 0)
if(read(fHdl,ln) = 0)
buffer = buffer + ln + chr$(13) + chr$(10)
FSIZE = LEN(fHdl)
newname = fName : mruArray()
CONTROLCMD WIN, STATUS_1, @SWSETPANETEXT, 1, STR$(FSIZE) + " bytes"
SETCAPTION WIN, "Tpad - [" + fName + "]"
For some obscure reason, the 'Filerequest' dialog does not return the selected file name.
:/ Ahem. Actually looking to fix this...
Nope - that doesn't work, either
See attached ZIP archive in first post.
+ Status bar now displays CAPS, INS and NUM keys state (ON/OFF)
+ Status bar now displays tips associated with menu items
+ The program now load a file passed on the command line
+ The program now load a file dropped on its window
+ The program now handles correctly printing files
See first post for attached ZIP archive.
+ Added "Goto Line" controls
+ Redone status bar
+ First 64Kb chunk of a large file is quickly loaded as "read-only"
+ The program now saves its screen position to INI file
Looking good, Hector
Why not put a STARTTIMER to handle the Statusbar messages with, say an amount of 50ms? You wouldn't then have to wait up to 1 second for a message to appear, as is happening now
Shortened the timer delay to 250ms and turned the "Goto Line" buttons to ownerdraw.
+ Added a ruler
As usual, see first post to download the updated version.
+ subclassed the ruler in its own window
+ Added a line marker to always know which line the cursor is on
I'm not seeing the red marker in the program, even though it is in the \res folder. Looks to be a naming issue
BTW, you can make your resource file more portable by simply having an entry as: 16x16 ICON "res\\small.ico" - missing out the full path
PS: Fixed it now
Well, thank you for the resource file tip, this is something i didn't knew.
I was tinkering with the binary icons, wondering why explorer displayed the small icon (16x16) even
with "Icons" or "Tiles" view activated.
Now, i understood that giving names to icon resources is not suitable.
So, i've replaced these by numbers in the source and resource files.
Also joined the binary to the ZIP archive.
That's great work you are doing, as stated before, please don't think I am in competition with you - what I am doing is something a little different to you.
Keep up the work.
See my last post:
Tidied up your code a little bit. Removed some unneeded code; added a second timer for the INS, NUM, etc, keypresses; kept the TIME$ at 1000ms; taken out the RETURNs next to the ENDSUBS. You don't need a return there unless it is actually returning something
It now compiles cleanly, as well
Thank you Brian, there's a bunch of warnings that just went away.
Andy, that's okay, i know you're working hard on your project. This is something else, entirely.
Well, i've just added an "About box" to the program.
Let's call it a day !
Liked the About box - very stylish!
Are you using a compression program on the final Tpad.exe? The exe you posted is smaller than the source code! And my anti-virus didn't like it at all - wouldn't let it run. That can happen a lot with compressed exes
My compiled exe is 184kb, and yours is 54kb - big difference
Unfortunately, i can't keep this "About box" as it is. When you click on the main program window scroll bars
while the "About box" is displayed, there is a side effect : you can't close it anymore. Try by yourself,
you'll see what i mean.
Had to change it from WINDOW to DIALOG.
And, yes, i use UPX to compact executables.
I barely use my antivirus. Most of the time, it detects perfectly legitimate programs to be some kind of threat.
And anti-virus programs are a heavy load on system resources. This is not acceptable : false positives + system
heavy load are just turning me off.
Whenever in doubt, i start the anti-virus and use on demand scan on the suspect file.
I have tried UPX before. If you put in a high value for the compression, a lot of programs just wouldn't run. And you must be using a tight compression value to get it from 184kb to 54kb - that's two-thirds!
I could see the point yonks ago, when RAM and disk space was at a premium, but it doesn't hold water now to compress programs so aggressively
Just my thoughts . . .
this is what i type in the console to get that :
UPX --best filename.exe
usually it takes less than 2 seconds to compact the file.
I don't agree with you : else why do you still archive files with ZIP (or RAR, etc...) ?
UPX uses LZMA compression, which is used by ZIP.
What you get, in fact, is a zipped executable which is unzipped into memory space and run from there.
Small is beautiful.
I don't like bloatware. Adobe Acrobat, Microsoft Office, all these very large software that bloat the hard drive
while you can get Sumatra PDF or PolyEdit which only takes a fraction of the space for the same
basic functionnalities. Mainly : open and read a PDF or a DOC file.
I don't need all the extra stuff that Adobe or Microsoft put into their bloated piece of software.
I rather like a small, fast program that does only one thing but does it correctly than a large, slow
program that does many things (and the coffee) incorrectly.
(and slow is incorrect given the processors we have these days).
Ok, enough - I just beg to differ. I still like your program, though!
Roughly, the roadmap is as follow :
- to finish the find/replace functions ("wholeword" & "replace all" options).
- to add a font selector with a filter for fixed pitch fonts.
- to add a basic file browser docked on the right.
- to add an options dialog.
- to add the capacity to show/hide ruler, gutter, toolbar, file browser via the menu.
- to add ownerdraw menu.
You may find this useful to you, I wrote it maybe 2 or 3 years ago, it's a constants search program.
It has 71 categories in it, with over 4,000 constants and values.
MSDN (and other sites) mention constant "XYZ" but not always the value.
Please have a look, scroll down to the end to get the last update I did.
There is also a help file & exe file if you just want to use it.
Hope this is useful to you.
This is really helpful, Andy. Added this to my toolbox. Thanks.
No problem - glad it helps.
I use it on many programs - it's a great reference tool.