Jump to content
  • Advertisement
Sign in to follow this  
ajm113

Rich Edit Win32 C++, Getting lines, changing fonts in specific areas?

This topic is 2470 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I'm writing a IDE for my programming language that's in WIP, and so far Rich Edit is a big pain trying to manipulate using subclasses to do what I want. I'm trying to make a syntax highlighting system and I want to write it from scratch. So I have more flexibility and gain some experience working with it. The two main problems I'm having is first of all: How do I get a line's text?

I've written this:




int iCommandLen = int(SendMessage(hWnd2, WM_GETTEXTLENGTH, 0, 0));
char *szCommand = new char[iCommandLen+1];
SendMessage(hWnd2, EM_GETLINE, 1, LPARAM(szCommand));
szCommand[iCommandLen] = '\0';


From the get error function from Win32 returns 6 as a invalid handler just after SendMessage, EM_GETLINE. I've done the research and it appears only I am having this issue on the net.

Also of course from my syntax highlighter I have to be able to change color or font of a pacific area of code when a keyword pops up when someone types it. Is there a way I can change font using something like:
const char* appendText = "\f\0\0\255\250\ Keyword! \f\255\255\255\250\"

Where it manipulates the text to have hidden commands for coloring that keyword on rich edit?

Thank you for any help!
-Ajm

Share this post


Link to post
Share on other sites
Advertisement
I would seriously recommend not trying to work with rich edit controls for syntax highlighting; it's just not designed to be extended in this way. Either write your own text box from scratch or grab an existing syntax highlighting control like Scintilla.

In any case, your EM_GETLINE parameters aren't quite right. The buffer you pass with EM_GETLINE should contain the buffer size in the first word. You have it uninitialized.

Share this post


Link to post
Share on other sites

I would seriously recommend not trying to work with rich edit controls for syntax highlighting; it's just not designed to be extended in this way. Either write your own text box from scratch or grab an existing syntax highlighting control like Scintilla.

In any case, your EM_GETLINE parameters aren't quite right. The buffer you pass with EM_GETLINE should contain the buffer size in the first word. You have it uninitialized.


Hey thanks! eehhh... In that case I may fallow the "NEATpad" tutorials from catch22, if it doesn't work out I'll just go with Scintilla.

Thanks again! :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!