Hack Forums
[.NET] Netpad | Full Notepad Replica in .NET | TextBox Control Flexibility - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Netpad | Full Notepad Replica in .NET | TextBox Control Flexibility (/showthread.php?tid=4834795)

Pages: Pages 1 2


* - SaketSaket - May 26, 2015

(May 26, 2015 03:14 AM)Odus Wrote:  I'm in talks with Microsoft over supplying it with every copy of Windows 10. My legal team has informed me I can expect several dollars; most likely $7.

Wow.. means we will get 3 editors with windows 10.. A notepad, wordpad & oduspad ;)


* - SaketSaket - May 26, 2015

(May 26, 2015 03:14 AM)Odus Wrote:  I'm in talks with Microsoft over supplying it with every copy of Windows 10. My legal team has informed me I can expect several dollars; most likely $7.

Wow.. means we will get 3 editors with windows 10.. A notepad, wordpad & oduspad ;)


* - Yazz - May 26, 2015

This is actually really cool


* - $uicidal - May 26, 2015

Damn good job, I'm impressed you exactly copied the Font form


* - ⁠Cammy - May 26, 2015

could you add a fix so that when you press ctrl+backspace the whole word gets removed? now it just shows [] when i do it as well as in the standard notepad program

ty homie


* - blu3 - May 26, 2015

Wow, that's amazing. That is a lot of hard work.


* - Odus - May 26, 2015

(May 26, 2015 11:45 AM)2k Wrote:  could you add a fix so that when you press ctrl+backspace the whole word gets removed? now it just shows [] when i do it as well as in the standard notepad program

ty homie

I'm pleased you discovered this, turns out the TextBox isn't written to behave that way, not even Ctrl+A is supported by default and only because of the shortcut on the MenuStrip does it work.

So this has to be done manually from what I can see. Here's what I have so far in the KeyDown event:
Code
If e.Control AndAlso e.KeyCode = Keys.Back Then
    e.SuppressKeyPress = True

    Dim spaceIndex As Integer = txt.Text.LastIndexOf(" "c)
    If spaceIndex > 0 Then
      txt.Text = txt.Text.Substring(0, spaceIndex)
      txt.SelectionStart = txt.Text.Length
    End If
End If

This functions well until the very first word in the document. I'll update with a fix probably tomorrow.


* - Ninja - May 26, 2015

I find it saddening that the source is not a one-liner.


* - CorrM - May 26, 2015

Nice Work, where source!!


* - Neos07 - May 26, 2015

Nice! I like it 🤝


* - The-One - May 27, 2015

(May 25, 2015 03:45 PM)Odus Wrote:  Known issues:
-FontDialog doesn't accept decimal as size input. I can't find a workaround for this, even when digging around the CommonDialog lib.

Because the size properties of FontDialog are integers. http://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/FontDialog.cs,278

(May 26, 2015 11:00 AM)Lawlly Wrote:  Damn good job, I'm impressed you exactly copied the Font form

He didn't, he used the FontDialog class as he explained.


* - 0xDEAD10CC - May 31, 2015

Minor issue... With the ".LOG" trick for notepad, after the timestamp is added to the text editor, the caret is placed on the line after the new timestamp which is automatically appended. Netpad places the caret at the beginning of the text editor control. Your ALT key shortcuts too for the menubar are not proper either. Remember to be naming each menubar item with the ampersand before the letter you want to use as well. (Ex: "E&xit")