Page 1 of 2 12 LastLast
Results 1 to 40 of 62

Thread: Re: TextEditor

  1. #1

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Continued from http://www.vbforums.com/showthread.p...=1#post1894962

    Quote Originally Posted by Disiance
    Wouldn't be to hard to write a new text editor. Did this program have special features in it?

    Not really,it was a standard Text Editor with midi interface. Yes it wouldnt be too hard to do. I would like to write it in C# but not a lot of people have the Framework installed. What language did you have in mind? I might just put together a simple one which supports auto complete and syntax highlighting. Problem is that I dont have enough time.
    Last edited by Danial; Jan 21st, 2005 at 07:57 PM.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  2. #2
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Current Work:
    SynReas (syntax highlighting and intellisense)

    Proposed Ideas:
    Support for HTML, ASP, and PHP
    ?Dynamic Menus - Load from file?
    ?FTP support?

    -------------------------------------------------
    My main language is VB pre-.NET
    I know a very little C++ (not even VC++), so I can't really do anything except tinker with existing code in a C-type language.
    Last edited by Disiance; Oct 5th, 2005 at 08:33 AM.
    "I don't want to live alone until I'm married" - M.M.R.P

  3. #3

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    My main language is VB pre-.NET
    I know a very little C++ (not even VC++), so I can't really do anything except tinker with existing code in a C-type language.
    Well C++ is not my cup of tea, though like you i can do the basic. Its either VB6 or C#. I am pretty busy currently but I should have some time in a month or so. I might give it a shot..
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  4. #4
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    no problem.
    I'm currently playing around with a method to get a function/variable box to pop up with the right contents for the object (in this case Response in ASP). I'm going to play with it and see if I can get an efficient routine for loading variables/functions and such for an object.
    "I don't want to live alone until I'm married" - M.M.R.P

  5. #5

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    no problem.
    I'm currently playing around with a method to get a function/variable box to pop up with the right contents for the object (in this case Response in ASP). I'm going to play with it and see if I can get an efficient routine for loading variables/functions and such for an object.
    That sounds great . We will have to design it such a way so we can load the defination file for "auto complete" for any other language.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  6. #6
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Right now I have the import file being handled pretty much like an INF file.
    "I don't want to live alone until I'm married" - M.M.R.P

  7. #7

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    Right now I have the import file being handled pretty much like an INF file.
    Check this article, i think we should use this as our base code. I would prefer if the interface looked similar to Visual Studio.Net IDE..

    http://www.vbaccelerator.com/home/VB...bs/article.asp
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  8. #8
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    I've got the object definitions part of the file import-feature done. A file to be imported is in the format:
    ------------------------
    [ASP]
    [OBJECT=Response]
    FUNCTION=Flush
    FUNCTION=Write
    PROPERTY=Buffer
    PROPERTY=CacheControl

    [OBJECT=Request]
    FUNCTION=BinaryRead
    PROPERTY=TotalBytes
    --------------------------------
    First line defines the code that the page/code type. The rest defines the code objects and then specifies their functions and properties.

    I'm thinking the file should also contain information on where code sections start (<% and %> for ASP, <? and ?> for PHP, etc) also so that ASP objects arn't displayed in PHP code.
    "I don't want to live alone until I'm married" - M.M.R.P

  9. #9
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: TextEditor

    I was bored and wrote a simplistic editor in C# about a year ago. It was never completed but if you want any features in it I'd be glad to tell you how to do it (though nothing too complex was ever done)

    http://dev.binaryidiot.com/binaryedit.php

  10. #10
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by kasracer
    I was bored and wrote a simplistic editor in C# about a year ago. It was never completed but if you want any features in it I'd be glad to tell you how to do it (though nothing too complex was ever done)

    http://dev.binaryidiot.com/binaryedit.php
    Quite a nice program! Thanks for the code offer too. The thing that stood out to me is the auto-indentation feature.
    "I don't want to live alone until I'm married" - M.M.R.P

  11. #11
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: TextEditor

    Quote Originally Posted by Disiance
    Quite a nice program! Thanks for the code offer too. The thing that stood out to me is the auto-indentation feature.
    Thanks!

    When I created it, I made a class that inherited the RichTextBox from the framework and the auto indent went as follows:

    This goes in the constructor of the class:
    Code:
    #region Constructor
    		public RichTextBox()
    		{
    			InitializeEvents();
    		}
    		#endregion
    This is the event needed to fire and use auto indent:
    Code:
    #region Events
    		private void InitializeEvents()
    		{
    			this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.this_KeyPress);
    		}
    		#endregion
    This is the actual code to auto indent:
    Code:
    		#region Auto Tab & Tab as Spaces
    		private string temp = "";
    		private int PrevLineSpaces = 0, PrevLineTabs = 0;
    		private bool _TabsAsSpaces = true;
    		[Category("BIML")]
    			[DefaultValue(true)]
    			[Description("Insert all tabs as a set of spaces")]
    			[Browsable(true)]
    		public bool TabsAsSpaces
    		{
    			get
    			{
    				return _TabsAsSpaces;
    			}
    			set
    			{
    				_TabsAsSpaces = value;
    			}
    		}
    		private int _AmountOfSpacePerTab = 4;
    		[Category("BIML")]
    			[DefaultValue(true)]
    			[Description("Amount of spaces inserted when the Tab key is pressed")]
    			[Browsable(true)]
    		public int SpacePerTab
    		{
    			get
    			{
    				return _AmountOfSpacePerTab;
    			}
    			set
    			{
    				_AmountOfSpacePerTab = value;
    			}
    		}
    		private bool _AutoTab =  true;
    		[Category("BIML")]
    			[DefaultValue(true)]
    			[Description("Finds whitespace on previous line and inserts it on the next line")]
    			[Browsable(true)]
    		public bool AutoTab
    		{
    			get
    			{
    				return _AutoTab;
    			}
    			set
    			{
    				_AutoTab = value;
    			}
    		}
    		private void this_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
    		{
    			if (_TabsAsSpaces)
    			{
    				if (e.KeyChar == Convert.ToChar(Keys.Tab))
    				{
    					System.Windows.Forms.SendKeys.Send("\b");
    					for (int i = 0; i < _AmountOfSpacePerTab; ++i)
    					{
    						System.Windows.Forms.SendKeys.Send(" ");}
    				}
    			}
    			if (_AutoTab)
    			{
    				if (e.KeyChar == Convert.ToChar(Keys.Enter))
    				{
    					temp = Convert.ToString(this.Lines.GetValue(this.GetLineFromCharIndex(this.SelectionStart - 1)));
    					for (int i = 0; i < temp.Length; ++i)
    					{
    						if (temp[i] == '	')
    						{
    							PrevLineTabs += 1;
    						}
    						else if (temp[i] == ' ')
    						{
    							PrevLineSpaces += 1;
    						}
    						else
    						{
    							break;
    						}
    					}
    					if (PrevLineTabs != 0)
    					{
    						for (int i = 0; i < PrevLineTabs; ++i)
    						{
    							System.Windows.Forms.SendKeys.Send("	");
    						}
    					}
    					if (PrevLineSpaces != 0)
    					{
    						for (int i = 0; i < PrevLineSpaces; ++i)
    						{
    							System.Windows.Forms.SendKeys.Send(" ");
    						}
    					}
    					PrevLineSpaces = 0;
    					PrevLineTabs = 0;
    				}
    			}
    		}
    		#endregion
    The code above also allows tabs to be inserted as spaces. The nice thing about this code is that it reserves the correct tabs and/or spaces used on the previous line. So if someone has a weird style of Tab Space Space, it'll be used on every following line.

    The template system is what I liked best though because anyone can add templates very easily. Just make a folder for the category and name the file appropriately.

    If you need anymore help just let me know. I never quite got the handle on syntax highlighting
    Last edited by Kasracer; Jan 22nd, 2005 at 03:21 AM.

  12. #12
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: TextEditor

    Almost forgot. I did a little write up of my RichTextBox on my site. Nothing special. Again, it was never finished but it may help:

    http://dev.binaryidiot.com/tutorials/rtb.php

    Something else worth noting is that .Net 1.0 and 1.1 has a bug in which calling Lines.Lenght() in the RichTextBox control erases all undo and redo levels. If you need a reliable way to calculate total and current line, check this out:

    Current Line:
    Code:
    public int CurrentLine()
    		{
    			return this.GetLineFromCharIndex(this.SelectionStart);
    		}
    Total Lines:
    Code:
    public int TotalLines()
    		{
    			return this.GetLineFromCharIndex(Int32.MaxValue);
    		}
    Not sure if that is useful to you or not. Again, this code is as if you're writing inside of a class derived from System.Windows.Forms.RichTextBox

  13. #13
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Thank you very much for the code -- and that it is well written and easily understandable so I can convert it to VB equivelant. Also thank you for pointing out the RTB's feature that gets the current line, will probably come in handy for line numbers.
    "I don't want to live alone until I'm married" - M.M.R.P

  14. #14
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by Danial
    Check this article, i think we should use this as our base code. I would prefer if the interface looked similar to Visual Studio.Net IDE..

    http://www.vbaccelerator.com/home/VB...bs/article.asp
    Looks nice, I'll see if I can get a GUI for the program working today.
    "I don't want to live alone until I'm married" - M.M.R.P

  15. #15
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: TextEditor

    Quote Originally Posted by Disiance
    Thank you very much for the code -- and that it is well written and easily understandable so I can convert it to VB equivelant. Also thank you for pointing out the RTB's feature that gets the current line, will probably come in handy for line numbers.
    No problem. If you need anything else from my program, just let me know.

    I am interested in syntax highlighting if you wouldn't mind sharing that when you work on that part. I just couldn't wrap my head around the color changes.

  16. #16
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by kasracer
    I am interested in syntax highlighting if you wouldn't mind sharing that when you work on that part. I just couldn't wrap my head around the color changes.
    Not a problem with me. I really don't have a clue on how to do it, but I know you can. I think that part will be Daniel's job.
    "I don't want to live alone until I'm married" - M.M.R.P

  17. #17

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    Not a problem with me. I really don't have a clue on how to do it, but I know you can. I think that part will be Daniel's job.
    kasracer, good to see you back in VBF. No ofcourse not, the editor we are planning to write most probably will be open source. I did have a go at Syntax highlighting in VB6, i have to code some where. Though it was very basic and I need to optimise it a lot before it can be used.

    Are you interested in the VB6 code or C# Code, dont think I will try it in C# right now since this editor will be VB6. I would have prefered to do it in C# but the Framework is not installed in most windows machine.

    Anyhow Good Progress Dr Dis .
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  18. #18
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Ok, I *believe* I have converted the code correctly from C# to VB, only a few tests will be able to tell. Unfortuneatly there was one part of the code I could not convert. I couldn't convert the "temp = Convert.ToString(this.Lines.GetValue(this.GetLineFromCharIndex(this.SelectionStart - 1)))" line, the RichTextBox does not have the Lines property/collection. I have attempted using the RevInstr function as well as writing my own version of RevInstr to see if I can pick out the current line, but it seems that I can't get it to work. any ideas? (its the commented out portion below).
    VB Code:
    1. Dim TabsAsSpaces As Boolean
    2.         TabsAsSpaces = True 'Use spaces instead of tabs
    3.         Dim AmountOfSpacePerTab As Integer
    4.         AmountOfSpacePerTab = 4 'How many spaces to use in place of one tab
    5.         Dim AutoTab As Boolean
    6.         AutoTab = True 'Automatically indent
    7.        
    8.         Dim temp As String, PrevLineSpaces As Integer, PrevLineTabs As Integer
    9.         temp = ""
    10.         PrevLineSpaces = 0
    11.         PrevLineTabs = 0
    12.  
    13.         If TabsAsSpaces Then
    14.             If KeyAscii = 9 Then
    15.                 txtDocument.Text = Left(txtDocument.Text, Len(txtDocument.Text) - 1)
    16.                 txtDocument.Text = txtDocument.Text & String(AmountOfSpacePerTab, "|")
    17.             End If
    18.             If AutoTab Then
    19.                 If KeyAscii = 13 Then
    20.                     temp = ""
    21.                     Dim II As Integer
    22.                    
    23.                     'temp = Convert.ToString(this.Lines.GetValue(this.GetLineFromCharIndex(this.SelectionStart - 1)))
    24.                    
    25.                     'For II = Len(txtDocument.Text) To 1 Step -2
    26.                     '    If Not Mid(txtDocument.Text, II - 1, 2) = vbCrLf Then
    27.                     '        temp = temp & Mid(txtDocument.Text, II - 1, 2)
    28.                     '        Else
    29.                     '            Exit For
    30.                     '    End If
    31.                     'Next II
    32.                    
    33.                    
    34.                     For II = 1 To Len(temp)
    35.                         If Mid(temp, II, 1) = vbTab Then
    36.                             PrevLineTabs = PrevLineTabs + 1
    37.                         ElseIf Mid(temp, II, 1) = " " Then
    38.                             PrevLineSpaces = PrevLineSpaces + 1
    39.                         Else: Exit For
    40.                         End If
    41.                     Next II
    42.                     If Not PrevLineTabs = 0 Then
    43.                         For II = 1 To PrevLineTabs
    44.                             txtDocument.Text = txtDocument.Text & vbTab
    45.                         Next II
    46.                     End If
    47.                     If Not PrevLineSpaces = 0 Then
    48.                         For II = 1 To PrevLineSpaces
    49.                             'txtDocument.Text = txtDocument.Text & " "
    50.                         Next II
    51.                     End If
    52.                     PrevLineSpaces = 0
    53.                     PrevLineTabs = 0
    54.                 End If
    55.             End If
    56.         End If
    "I don't want to live alone until I'm married" - M.M.R.P

  19. #19
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: TextEditor

    Change 'this' to 'me' and try again. VB's me = C#'s this.

    Other than that I'm not sure. I'm not as good with VB as I am with C#.

  20. #20
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by kasracer
    Change 'this' to 'me' and try again. VB's me = C#'s this.

    Other than that I'm not sure. I'm not as good with VB as I am with C#.
    the "this" in your code referenced the RichTextBox correct?
    "I don't want to live alone until I'm married" - M.M.R.P

  21. #21

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    the "this" in your code referenced the RichTextBox correct?
    No, this in C# always referes to the Current Instance of the Parent Object e.g Class/Form.

    Say you have

    Code:
    myClass
    {
          string myString;
    
         public void myFunction
         {          
              this.myOtherfunction(this.myString);
              //you could also write myOtherfunction(myString);
         }
          
          public void myOtherFunction(string test)
          {
          }
    }
    In VB.Net you replace this with me i think.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  22. #22

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    I think that part will be Daniel's job.
    Today i spend some time on Syntax Highlighting. I searched for some code on the net, most were tons and tons of code. So I decided to write something on my own. I put together something simple that works, not sure if it will be able to handle large amount of text efficiently. I am gonna do some test tonight if it works reasonable i will post it here.

    Any idea a max limit of a RichTextBox? Just want to get an idea how fast is my function with max amount of text..
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  23. #23
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by Danial
    No, this in C# always referes to the Current Instance of the Parent Object e.g Class/Form.
    Ahh, ok, I'll see if I can get the scriptlet working.

    I don't know what the RTB's maximum length is.
    I'm also working on a system (I call it Syntax Reasoning) that detects whether a word is an object, property, function, or language-reserved word. This will be used for the intellisense, and could also be easily integrated with the syntax highlighting.
    "I don't want to live alone until I'm married" - M.M.R.P

  24. #24
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Ok, I've gotten the program to extract certain lines.
    New problem: When the tab is replaced by spaces, the program doesn't prevent the tab, it just adds the tab and the spaces.. How do I kill the tab?
    "I don't want to live alone until I'm married" - M.M.R.P

  25. #25
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: TextEditor

    Quote Originally Posted by Danial
    Today i spend some time on Syntax Highlighting. I searched for some code on the net, most were tons and tons of code. So I decided to write something on my own. I put together something simple that works, not sure if it will be able to handle large amount of text efficiently. I am gonna do some test tonight if it works reasonable i will post it here.

    Any idea a max limit of a RichTextBox? Just want to get an idea how fast is my function with max amount of text..
    Post your function and we'll see if we can optimize it. Just remember, make sure you only check specific lines. Checking the entire page everytime will be very inefficient and slow.

    My idea was to scan the current line for changes on key press and, if there was a " on the line, scan the rest of the document until it finds a closing ".

    Quote Originally Posted by Disiance
    Ok, I've gotten the program to extract certain lines.
    New problem: When the tab is replaced by spaces, the program doesn't prevent the tab, it just adds the tab and the spaces.. How do I kill the tab?
    I solved that problem by putting in a backspace before inserting the spaces. In VB.Net, I believe it's different and not the \b used in C#. I'm not sure what it is for VB.Net but insert that before inserting spaces and you'll be fine.

  26. #26
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by kasracer
    My idea was to scan the current line for changes on key press and, if there was a " on the line, scan the rest of the document until it finds a closing ".
    --Excellent idea! Although it won't just check for quotes as it will color things such as "As", "For", "Select Case" in ASP, and then others in PHP. As I stated before I'm working on a system to detect those.

    Quote Originally Posted by kasracer
    I solved that problem [tabs being entered with spaces] by putting in a backspace before inserting the spaces. In VB.Net, I believe it's different and not the \b used in C#. I'm not sure what it is for VB.Net but insert that before inserting spaces and you'll be fine.
    That would work, except that the function is called from VB before the tab is entered. I think I've found a workaround though, a little ugly right now though.
    Last edited by Disiance; Jan 24th, 2005 at 12:42 PM.
    "I don't want to live alone until I'm married" - M.M.R.P

  27. #27

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by kasracer
    Post your function and we'll see if we can optimize it. Just remember, make sure you only check specific lines. Checking the entire page everytime will be very inefficient and slow.
    Yes indeed, thats what I concluded too, i wrote various functions but they were too slow going through large document. I even tried modifying the RTF. It works fine for Higlighting as you go, but when you paste large document it becomes un-useable.

    So i have switched to coloring only visible lines. Just put together some API to get the visible lines now I will try applying my coloring function and see how it goes. I will keep you posted.

    Thanks.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  28. #28
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    I have written a GetLine function Danial. You could pass the cursor's location on KeyPress, then get the altered line, and then just color that line.

    Also I believe I have gotten the AutoIndent feature fully operational. I've also added a feature that triggers when the user presses the [BACKSPACE] key, it will then see if multiple spaces should be erased (due to the convert tabs to spaces) I'm going to put it through a few more tests and then post the code here. I'm sure you guys can optimize it a bit, it is a bit ugly -- which brings up another thing. Is there a way to disable the RTB's update until after a function is over?

    Could you please send me the function that gets the RTB's visible lines Danial? I assume it would be very useful for line numbers.
    "I don't want to live alone until I'm married" - M.M.R.P

  29. #29

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    I have written a GetLine function Danial. You could pass the cursor's location on KeyPress, then get the altered line, and then just color that line.

    Also I believe I have gotten the AutoIndent feature fully operational. I've also added a feature that triggers when the user presses the [BACKSPACE] key, it will then see if multiple spaces should be erased (due to the convert tabs to spaces) I'm going to put it through a few more tests and then post the code here. I'm sure you guys can optimize it a bit, it is a bit ugly -- which brings up another thing. Is there a way to disable the RTB's update until after a function is over?

    Could you please send me the function that gets the RTB's visible lines Danial? I assume it would be very useful for line numbers.
    Here is my first attempt. Its not 100% complete. Its not accurate yet, I will iron out the bug soon.

    Paste some text and test it out.

    As for disable RTB's updat, you can do it using LockWindowUpdate API.

    Good work
    Attached Files Attached Files
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  30. #30
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by Danial
    Here is my first attempt. Its not 100% complete. Its not accurate yet, I will iron out the bug soon.

    Paste some text and test it out.

    As for disable RTB's updat, you can do it using LockWindowUpdate API.

    Good work
    1) You forgot to upload the thing or link to it
    2) How do you unlock a window after locking it?
    "I don't want to live alone until I'm married" - M.M.R.P

  31. #31

    Thread Starter
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: TextEditor

    Quote Originally Posted by Disiance
    1) You forgot to upload the thing or link to it
    2) How do you unlock a window after locking it?
    That was fast . I couldnt beat you to it..

    To lock the window pass the hwnd of the rtb and to unlock it simply call
    LockWindowUpdate False

    That will unlock.

    I am on Messenger now...
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  32. #32
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    That's right, [passing false to the LockWindowUpdate] I remember now. That's been bothering me for a while now
    I'll download and look at the code you posted a little later today when I've got more time.
    "I don't want to live alone until I'm married" - M.M.R.P

  33. #33
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    I believe I have the auto-indent feature 100% working, if we can ever catch the other on MSN I'll send you the code. If not I'll send you a PM with a link to it.
    "I don't want to live alone until I'm married" - M.M.R.P

  34. #34
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    ookkkaayyy, it's been a while,, dunno if anyone's still receiving response notifications on this thread anymore...

    Reason I never gave updates is because for some reason the subclass method crashed the program on all computers but my own, but I decided to restart the project and have gotten it to work on the rest of the computers. If anyone's still interested than please speak up.
    "I don't want to live alone until I'm married" - M.M.R.P

  35. #35
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: TextEditor

    Just in case you didn't find an answer, the RichTextBox doesn't have a text limitation. Apparently it can hold any amount of text, as apposed to the 64k limit of the textbox.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  36. #36
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Quote Originally Posted by chemicalNova
    Just in case you didn't find an answer, the RichTextBox doesn't have a text limitation. Apparently it can hold any amount of text, as apposed to the 64k limit of the textbox.

    chem
    Thank you very much for that info.
    "I don't want to live alone until I'm married" - M.M.R.P

  37. #37
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: TextEditor

    What would kick the arse off all other text editors would be to have intellisense.
    A couple of editors (such as Notepad++) have autocomplete
    The trouble is that it doesn't filter based on what you have previously typed.

    Well you know what intellisense is.

    Just making the project potentially harder for you

  38. #38
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    That was in the concept plan. Colored text and Intellisense together in a system I call SynReas (Syntax Reasoning).

    Would you mind being a tester agmorgan?
    "I don't want to live alone until I'm married" - M.M.R.P

  39. #39
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: TextEditor

    Im all for testing Text Editors
    Let me know when you are ready to test

  40. #40
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: TextEditor

    Okay, the project is attached. Nothing of the SynReas is really in at the moment, that is the next step. The other features (like auto-indent and converting tabs to spaces) are in, but there is no options form yet to change them...those are loaded in the frmMain_Load() sub.
    Attached Files Attached Files
    "I don't want to live alone until I'm married" - M.M.R.P

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width