News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Get all charranges starting with a digit in richtext edit

Started by rc, November 02, 2019, 02:16:00 AM

Previous topic - Next topic

rc

Hello community,

is there an easy way to get all strings starting with a digit in a rich text control?
I want to parse the text in a rich text edit control and get all charranges starting with a digit. CHARRANGE.
I've already implemented a simple "Find Text" feature in my editor so the user can search for text in their document. I just thought finding text starting with a digit must work similar.

What i want to do is implement a very simple highlighter that highlights digits, strings and comments. So that it is very universal.
So analog i need to check somehowe if it is a comment (starting with ;) or a string (inbetween quotes)

The rules would be:
- check if it is a comment -> highlight comment, else:
    - check if it is a string (inbetween quotes) -> highlight string, else:
        - check if it starts with a digit (e.g. 41h) -> highlight digit

Or:
- check if digit and not within a comment or string -> highlight digit
- check if string (inbetween quotes) and not inside comment -> highlight string
- check if comment -> highlight comment

The problem is, how do i get the charranges of a text inbetween quotes, or a comment starting with ; and the end of line or a text starting with a digit and the last character of that text.

jj2007

- use the EM_GETTEXTLENGTHEX message to know the length of your text
- allocate a buffer
- use the EM_GETTEXTEX message to load your text into the buffer
- parse the buffer

nidud

deleted

rc