Sign in to follow this  
geekalert

Subclassing?

Recommended Posts

geekalert    193
How would I modify the Win32 "EDIT" class so that it can highlight certain sections of XML? (I am making a small XML editor, plz dont ask why) I've heard subclassing involves MFC - how can I not use MFC (Win32 API only!)? Thanks in advance.

Share this post


Link to post
Share on other sites
I think you're confusing a few different ideas here.

To create your own edit control that does XML syntax highlighting does not require "subclassing" or any form of inheritance; inheritance is just an easy way to get that accomplished. For instance, you can have your own class inherit from the MFC class for an edit control, and then you can simply override the display functions to perform the syntax highlighting.

If you want to stick strictly with the Win32 API, you should keep in mind that you're working with a C based library, which makes things like this more difficult, to the extent that I wouldn't consider it worth the attempt, considering how much code you'd most likely have to reinvent. In all honesty I recommend you find another library built on top of the Win32 API that's more useful for this sort of thing. MFC helps, but there are other options if you're opposed to using it. Recently most of my GUI code has been done using GTK for instance.

Share this post


Link to post
Share on other sites
Colin Jeanne    1114
To save yourself some time, you might want to look into to using Scintilla for your editor. It is a well tested and powerful control. Applications like Notepad++ use it.

If you'd like to learn about subclassing anyway then you should take a look at subclassing as presented by the MSDN. Some of the tutorials at Catch-22 make use of subclassing. I encourage you to take a look at the custom control tutorials.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this