How to support a new exercise type
Check list
Let's assume that a new exercise type, named 'New Exercise', is going to
be programmed. These are the steps to follow:
- In /src/exercises/ create the exercises control NewExerciseCtrol
- In /src/html/ create the exercises params object NewExerciseCtrolParms.h
- Include the new control in /scr/html/Tags.cpp
- Add #include "../exercises/NewExerciseCtrol.h"
- Add #include "NewExerciseCtrolParms.h"
- Modify enum EHtmlObjectTypes (located just before TAG_HANDLER_PROC(tag) )
to add a new item eHO_Exercise_NewExercise
- Modify TAG_HANDLER_PROC(tag) to take into account the new exercise (in two points)
- Review documentation comments
Optionally, you might have to use helper classes, such as constrains to configure
the exercises or generators to generate the exercise values.
Typically, you should:
- In /src/exercises/ create the exercise constrains object NewExerciseConstrains.cpp,.h
- Modify /src/exercises/Generators.cpp,.h to add new random/constrained generator methods
Finally, to test the new control you have to:
- Add a test page to a book (i.e. v3_TestBook):
- Create file for new page (i.e. v3_TestBook_NewExercise.htm)
- Add this page to TOC file v3_testBook.hhc
- Add this page to index file v3_testBook.hhk
- Do not forget to empty directory /temp to force the program to load a
fresh updated version of the test book.