Tutorial Step 3

This sample demonstrates the use of a WEL_CLIENT_DC to display output in the MAIN_WINDOW. The output is shown below:

step3

Compiling

  • Launch EiffelStudio.
  • Click Add project
  • Browse to $ISE_EIFFEL\examples\wel\tutorial\step3\.
  • Choose tutorial_step3.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 should see a WEL_FRAME_WINDOW displayed . If you click the left mouse button in the client area of the window, the coordinates of the click (Relative to the top left of the client area), will be displayed. Clicking the right mouse button in the client area will clear the window.

Under the Hood

This system is a demonstration of how to gain access to the client area of a window using a WEL_CLIENT_DC . The creation procedure of the DC takes a WEL_WINDOW as an argument, and in this sample, we pass the MAIN_WINDOW. Using this DC, it is a simple step to output the position of the mouse which is provided as arguments to on_left_button_down.

on_right_button_down has also been redefined to call invalidate which clears the client area of the window. This sample contains the following classes:

  • TUTORIAL_STEP3
  • MAIN_WINDOW

See Also:
Common message hooks