Tutorial Step 6

This sample builds on tutorial step 5 by preventing the loss of the drawing when Windows re-draws the client area of the WEL_FRAME_WINDOW . The output is shown below:

step6

Compiling

  • Launch EiffelStudio.
  • Click Add project
  • Browse to $ISE_EIFFEL\examples\wel\tutorial\step6\.
  • Choose tutorial_step6.ecf
  • Choose the location where the project will be compiled, by default the same directory containing the configuration file.
  • Click OK.

Running

After launching the sample, you will see a WEL_FRAME_WINDOW displayed. By holding down the left mouse button, and moving the mouse (Within the client area of the window), you will be able to draw on the client are of the window. If you press the right mouse button, a WEL_MODAL_DIALOG will pop up which allows you to enter the thickness of the line that is drawn. If you re-size the window, then the drawing will be re-drawn.

Under the Hood

This system uses a redefined on_paint to re-draw the contents of the window. A LINKED_LIST of LINES is used to store all the lines that have been drawn and during on_paint, this list is traversed in order to re-draw each line. This sample contains the following classes:

  • TUTORIAL_STEP6
  • MAIN_WINDOW
  • LINE_THICKNESS_DIALOG_CHART
  • APPLICATION_IDS
  • POINT
  • LINE