### Creating an Information Area

The information area is a small rectangular area that is usually located at the bottom of a frame window. You can use the information area to display:

- A brief explanation of the state of an object
- Information about the completion of a process
- Information messages displayed with fly-over help

Use the IInfoArea class to create and manage the information area. Objects of IInfoArea class provide a frame extension to show information about the menu item where the cursor is positioned. The string displayed in the information area is defined in a string table in the resource file.

The following sample uses the IInfoArea class to create the information area and the text to display in it.

1. The menu bar and string table are defined in the ahello3.rc file. The string table contains strings of text, and each string is associated with a menu item. For Windows, when you choose the menu item, the string related to that item displays in the information area. The following is a sample OS/2 and AIX resource file:

       #include "ahellow3.h"

       ICON WND_MAIN ahellow3.ico

       STRINGTABLE
         BEGIN
           STR_HELLO,  "Hello, World!!!"
           WND_MAIN,   "Hello World Sample - Version 3"
           STR_INFO,   "Use Alt-F4 to Close Window"
           MI_ALIGNMENT,"Alignment Menu"
           MI_CENTER,  "Set Center Alignment"
           MI_LEFT,    "Set Left Alignment"
           MI_RIGHT,   "Set Right Alignment"
           STR_CENTER, "Center Alignment"
           STR_LEFT,   "Left Alignment"
           STR_RIGHT,  "Right Alignment"
         END

       //**************************************************************************
       // Menu bar for main window - used by IMenuBar Class                       *
       //   Define menu bar layout and relate symbolic names to menu item strings.*
       //**************************************************************************
       MENU WND_MAIN
         BEGIN
               SUBMENU "~Alignment", MI_ALIGNMENT
                 BEGIN
                   MENUITEM "~Left",       MI_LEFT
                   MENUITEM "~Center",     MI_CENTER
                   MENUITEM "~Right",      MI_RIGHT
                 END
         END

   The same resource file would appear as follows for a Windows application:

       #include "ahellow3.h"

       WND_MAIN          ICON       ahellow3.ico

       STRINGTABLE
         BEGIN
           STR_HELLO                     ,    "Hello, World!!!"
           WND_MAIN                      ,    "Hello World Sample - Version 3"
           STR_INFO                      ,    "Use Alt-F4 to Close Window"
           MI_ALIGNMENT                  ,    "Alignment Menu"
           MI_CENTER                     ,    "Set Center Alignment"
           MI_LEFT                       ,    "Set Left Alignment"
           MI_RIGHT                      ,    "Set Right Alignment"
           STR_CENTER                    ,    "Center Alignment"
           STR_LEFT                      ,    "Left Alignment"
           STR_RIGHT                     ,    "Right Alignment"
         END

       WND_MAIN  MENUEX
         BEGIN
           POPUP     "&Alignment"               ,  MI_ALIGNMENT
             BEGIN
               MENUITEM  "&Left"                    ,  MI_LEFT
               MENUITEM  "&Center"                  ,  MI_CENTER
               MENUITEM  "&Right"                   ,  MI_RIGHT
             END
         END

2. This code is from the ahello3.hpp file. The highlighted lines add an information area object to the AHelloWindow class.

       class AHelloWindow : public IFrameWindow
       {
       public:
           enum Alignment
           {
             left, center, right
           };

           AHelloWindow(const unsigned long windowId);
           virtual
              ~AHelloWindow();

       /*------------------------------------------------------------------------|
       | This function is used to change the hello static text window.           |
       |   setTextAlignment - Align the static text horizontally.  The text is   |
       |           always centered vertically by design.                         |
       |------------------------------------------------------------------------*/
           virtual AHelloWindow
            &setTextAlignment( const Alignment alignment);

         private:
           IMenuBar      menuBar;
           IStaticText   statusLine;
           IStaticText   hello;
           IInfoArea     infoArea;
           ACommandHandler commandHandler;
       };

3. In the ahello3.cpp file, construct the information area when AHelloWindow is created as follows:

       AHelloWindow :: AHelloWindow(const unsigned long windowId)
         : IFrameWindow(IFrameWindow::defaultStyle() |
                        IFrameWindow::minimizedIcon,
                        windowId)
          ,menuBar(WindowId, this)
          ,statusLine(WND_STATUS, this, this)
          ,hello(WND_HELLO, this, this)
          ,infoArea(this)
          ,commandHandler(this)
       {

       /*------------------------------------------------------------------------|
       |  Set the hello world static text window as the client window.           |
       |------------------------------------------------------------------------*/
         setClient(&hello);

       /*------------------------------------------------------------------------|
       |  Add the status line as an extension to the frame above the client      |
       |    window with the height calculated from the maximum height of a       |
       |    character in the current font.                                       |
       |------------------------------------------------------------------------*/
         addExtension(&statusLine,
                      IFrameWindow::aboveClient,
                      IFont(&statusLine).maxCharHeight());

       /*------------------------------------------------------------------------|
       |  Set the values for the text controls from strings in the resource file.|
       |    The infoArea default text is displayed when no menu item is active.  |
       |------------------------------------------------------------------------*/
         hello.setText(STR_HELLO);
         infoArea.setInactiveText(STR_INFO);

Windows

Creating a Frame Window
Providing Help Information

IFrameWindow
IFlyText
IFlyOverHelpHandler