### Hello World Version 6: Adding a Font Dialog, Pop-up Menus, Notebooks, and Graphics

Version 6 of the Hello World application shows you how to do the following:

- Use a font dialog to change the font for a static text window
- Use a pop-up menu and a menu handler
- Use a notebook with multiple controls for changing application settings
- Use the IProfile class to save and read user settings
- Use a combination box instead of an entry field
- Add help to your application using native Windows help (RTF) or the OS/2 Information Presentation Facility (IPF) for portable help files
- Use the 2-dimensional graphics classes

The main window for Version 6 of the Hello World application looks like this:

#### Listing the Hello World Version 6 Files

The following files contain the code used to create version 6:

File | Type of Code
--- | ---
ahellow6.cpp | Source code for main procedure and AHelloWindow class
ahellow6.hpp | Class header file for AHelloWindow
ahellow6.h | Symbolic definitions file shared by all source files
adialog6.cpp | Source code for the ATextDialog class
adialog6.hpp | Class header file for ATextDialog
aearthw6.cpp | Source code for the AEarthWindow class
aearthw6.hpp | Class header file for AEarthWindow
anotebw6.cpp | Source code for the ANotebookWindow class
anotebw6.hpp | Class header file for ANotebookWindow
ahellow6.rc | Resource file
ahellow6.ico | Icon file
ahellow6.rtf and ahello6.hpj | Help source files for Windows help
ahello6.ipf | IPF help source files

#### Exploring Hello World Version 6

The following list describes the tasks performed by version 6 of the Hello World application that are not already described for previous versions. The tasks are as follows:

- Implementing an ITimer object for updating the time and the twinkling of the stars.

  Refer to timehdr.cpp and timehdr.hpp in the ownhdr sample for an example of writing your own handler. This sample demonstrates writing your own handler by implementing a simple time handler that posts a WM_TIMER event and calls ATimeHandler::tick every second.

  Note: | The ownhdr sample demonstrates IHandler derivation; the timer functions might not handle all cases and might break in a multithreaded environment.

  Refer to the aearthw6.cpp and aearthw6.hpp files for ATwinkleTimeHandler. The ATwinkleTimeHandler uses the ITimer class to provide stars that twinkle.

- Changing the status line in AHelloWindow to a split canvas with the status alignment plus the current date and time

  Hello World version 6 also provides public functions for setting the date and time formats.

- Adding a pop-up menu and a menu handler to the AHelloWindow class

  Hello World version 6 derives a new class, APopUpHandler, from IMenuHandler, and overrides the virtual function makePopUpMenu to provide pop-up menus for the hello and earthWindow static text windows. This version also demonstrates using static and dynamic pop-up menus.

- Adding a new Edit submenu item, Fonts...

  This new menu item invokes the AHelloWindow::setHelloFont function that uses a modal IFontDialog to change the font in the AHelloWindow::hello static text window.

- Adding a new submenu to the Settings menu item

  This new submenu contains Read, Open..., and Save menu items.

- Adding a new Settings submenu item, Open...

  This new menu item invokes the AHelloWindow::openHelloSettings function that dynamically creates a nonmodal ANotebookWindow frame window. The nonmodal frame window lets you change AEarthWindow settings and date and time formats using check boxes, a slider, and radio buttons from a notebook window.

Refer to anotebw6.hpp and anotebw6.cpp to see how the new ANotebookWindow class is defined and implemented, and to ahellow6.cpp for an example of its use.

- Adding a new Settings submenu item, Save

  This new menu item invokes the AHelloWindow::saveHelloSettings function that saves the hello font and the changeable user settings to an IProfile class file. Hello World version 6 uses a message box to indicate that the save completed successfully.

- Adding a new Settings submenu item, Read

  This new menu item invokes the AHelloWindow::readHelloSettings function that reads the hello font and the changeable user settings from an IProfile class file. Hello World version 6 uses a message box to indicate that the read completed successfully.

- Enhancing the AEarthWindow function using graphics to include the following:
  - Setting and querying the intensity of the stars
  - Making the stars start and stop twinkling
  - Setting and querying the number of atmosphere layers
  - Setting and querying the color of the earth

  Refer to the aearthw6.cpp and aearthw6.hpp files for more information.

Events and Event Handlers
Controls
Resources

Converting Application Resources
Adding Menus to your Application
Layout Using Canvas Controls
Creating and Using Text Controls
Using List and Slider Controls
Creating and Using Notebooks
Using Common Dialogs

IEvent
ICommandHandler
IFileDialog
IFontDialog
IHandler
IHelpWindow
IHelpHandler
IMenu
IMenuBar
INotebook