The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: David on December 16, 2009, 06:33:34 PM

Title: How can I add auto indents to my IDE
Post by: David on December 16, 2009, 06:33:34 PM
So I made a colored IDE using RichEdit box, however, I am having trouble using auto indents.

For example, if somebody indents five, it auto takes you to where the text above it was at.

i.e.

              ;I type something here
             ;then when i press tab once it takes me here, instead of pressing tab twice.  How do they do this?  Can anybody give me an example (not in code) but in writing ;about which functions would be used?

;Also, when somebody types

.WHILE TRUE
      ;how do I make it indent here in the next line?  Do SendKeys like that?  Or use a special API function for the rich text box?  If so, which function would this be?
.ENDW
Title: Re: How can I add auto indents to my IDE
Post by: jj2007 on December 16, 2009, 07:11:31 PM
Hi,
Here is a list of the messages I used to get autoindents with RichMasm. Basically, you have to study the line before, and add a tab if needed.
Hope this helps,
JJ

  invoke SendMessage, hRE, EM_EXGETSEL, 0, eax
  invoke SendMessage, hRE, EM_GETTEXTRANGE, 0, eax
  invoke SendMessage, hRE, EM_LINEINDEX, eax, 0
  invoke SendMessage, hRE, EM_EXLINEFROMCHAR, 0, eax
  invoke SendMessage, hRE, EM_GETTEXTRANGE, 0, eax
  invoke SendMessage, hRE, EM_EXSETSEL, 0, addr chrg
  invoke SendMessage, hRE, EM_SETTEXTEX, addr stx, reptxt ; replace with new text