ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5


5 - Rolling Your Own CWindow...

The last two areas to be covered in the Form Editor involve inheritance and object construction. Most likely, every form you create will inherit from the generic CWindow class, as with our example form setup:

CWindow1::CWindow1() : CWindow( CWindow1_CWindow1,  <and so on...>
However, there may be cases where you wish to inherit from another class. For instance, you may have created a basic window class that has extra code in it (perhaps to handle the close button, or to do additional window sizing or coloring). For whatever reason, to inherit from this object instead of the CWindow class, just change the Class Name field for the form in the Editor - this entry becomes the parent definition. However, the class then needs this new object defined in the header file in order to compile. This is where the Source/Header Text menu option comes in. Code entered here goes above the object definition in the header, and can be an #include directive, or anything else. To see an example of it, look at the eg_2.fff file via the Source/Header Text display, and the resulting header output.

In summary, create your project as usual, and use the Source/Class Text menu option to add object functions and variables to the Form Editor's output. Include the header from this file into your own source code, and define the additional functions there. At this point, you've successfully integrated your code to the Editor's output. The Form Editor creates the initial look; which these features, you're free to add the 'meat' of the project simply and easily.

Previous Section


Copyright © 2001-2006 ebmDevMag.com - Legal Notice