WordPad clone source

Share your advanced PureBasic knowledge/code with the community.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

WordPad clone source

Post by Fangbeast »

I needed some of the functionality of WordPad namely, bold, italics, bullets, font colours etc and to learn how to do it, hunted the forum for snippets of all sorts and here is the result.

I know there is better in/ on the forums but I didn't need a full notepad, just the basics. Here is the source project below, hope it's useful to someone.

http://members.westnet.com.au/bangfeast ... ePiddle.7z

***** Update *****

Didn't realise that it had been nearly 6 (??) years since I worked on this and needed it again so I have done a massive update to PB 5.23 compatibily, fixed things that were wrong and added things I thought that I needed.

Hope the link above is working.
[Top menu bar]

Load an RTF file
Save to an RTF text file
Search text
Find first on RETURN then:
Find next on button or F3
Search exact case or not
Search up or down
Toggles
Screen snap
Word wrap
Read Only
AutoSave every 15 minutes
Help file (no!)

[Effects bar]

Graphical font selector (FluidByte)
Font Size
Character Locale (Not yet)
Bold, italic, underline, colour (SROD), Para left/middle/right, bullet

[Edit form]

Apart from typing in there (Grin), you can paste RTF text from other sources.
Select all text in the gadget
Control + Up or Down changes selected font size

[Statistics bar]

Number of lines, words and characters are displayed.

[Fake status bar]

Actually a stringgadget

Tried to add shortcuts for every menu option and also to keep the code consistent. Can't spend any more time on this as there are other programs to get out the door.

InfraTec was once again an invaluable help fixing things and giving suggestions when I had no hope of doing so.
Apart from the list of things above, there were lots of small improvements so go through the code with a fine toothed comb and improve it where I could not. Doubless there are a lot of things that could be better.
Last edited by Fangbeast on Sun Nov 23, 2014 12:38 pm, edited 2 times in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

As usual, looks very nice.

Thanks for sharing with us (again) :)

cheers
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Looks nice fangles. Thanks. :)
I may look like a mule, but I'm not a complete ass.
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

Fangles, I would love to look at it. But I can't unzip it. :cry:

Don't know why, but I can't get a 7zip running on my machine. Two different virus scanners object strenuously when I try to install it.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

srod wrote:Looks nice fangles. Thanks. :)
For what?? Using *Most* of your code to make another toy??? :D :D :D
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

TerryHough wrote:Fangles, I would love to look at it. But I can't unzip it. :cry:

Don't know why, but I can't get a 7zip running on my machine. Two different virus scanners object strenuously when I try to install it.
Hi Terry. WinRar; as well as a lot of other archivers; also undo 7zip files.

Regards.

P.s I use Izarc' also free; that does 7Zip. It's a popular format these days, good compression.
Last edited by Fangbeast on Tue Jan 27, 2009 6:37 am, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Don't mind if I do ;)
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
idle
Always Here
Always Here
Posts: 5915
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

very nice thanks.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

pdwyer wrote:Don't mind if I do ;)
Don't mind if you do what????
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

idle wrote:very nice thanks.
Still toying with it.

Now I want to add FluidByte's nice new ownerdrawn combobox with icons and fonts and srod's RTF routines that allow images.

But first, I have to survive the next week's temperatures.

Or someone else could do it:):)

P.S. Also need to add (Just like wordpad) that buttons act like toggles for when you select a block of text so they detect the current style on the selected text and the appropriate button is set to that state.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Update

Post by Fangbeast »

1. Just added FluidByte's nice ownerdrawn combo boxes with icons and font preview in the combo box itself, good one.

2. Fixed an enum I neglected to leave to the compiler which would have meant a crash sooner than later,

3. resized the form to accomodate some of the long font preview names.

@TerryHough, made the package a standard zip for you and everyone else. Link in first post.

Still lots could be done if we survive the heat:)
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Fangbeast wrote:
pdwyer wrote:Don't mind if I do ;)
Don't mind if you do what????
help myself to your code :D
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
idle
Always Here
Always Here
Posts: 5915
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

Fangles sounds like you need a Beer but don't be drinking any of that Fosters or XXXX or vb bitter stuff as its like making love in a canoe in that it's f***ing near water.

Hope you get a moment to chill out!
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

idle wrote:Fangles sounds like you need a Beer but don't be drinking any of that Fosters or XXXX or vb bitter stuff as its like making love in a canoe in that it's f***ing near water.

Hope you get a moment to chill out!
I'm dizzy a lot lately and the heat doesn't help. Partly that diabetic medication I am on. Only good thing about alcohol is that it kills weeds. Give me a soy milk with milo and a huge pair of hooters every time!
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4790
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

Folks, I made a mistake with FluidByte's routine so that setting fonts don't work any more. Replace the existing #Gadget_notepiddle_font handler with the one below.

Code: Select all

Select EventGadget()
  Case #Gadget_notepiddle_font
    Select EventType()
      Case #PB_EventType_RightClick
        Editor_SetFont(#Gadget_notepiddle_edit) ; Wrapper for Editor_Font
    EndSelect
Add this wrapper to your code:

Code: Select all

Procedure Editor_SetFont(Gadget)
  CurrentFontNumber = GetGadgetState(Gadget)
  ForEach ftd()
    If ListIndex(ftd()) = CurrentFontNumber
      CurrentFontName.s = ftd()\Name
      Break
    EndIf
  Next
  If CurrentFontName
    Editor_Font(Gadget, CurrentFontName)
  EndIf
EndProcedure
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Post Reply