home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / HELLO5 / AHELLOW5.CPP < prev    next >
C/C++ Source or Header  |  1995-05-01  |  35KB  |  464 lines

  1. /*****************************************************************************
  2. * HELLO WORLD SAMPLE PROGRAM - Version 5: Class Implementation (ahellow5.cpp)*
  3. *                                                                            *
  4. * COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1995. *
  5. *                                                                            *
  6. * DISCLAIMER OF WARRANTIES:                                                  *
  7. *   The following [enclosed] code is sample code created by IBM              *
  8. *   Corporation.  This sample code is not part of any standard IBM product   *
  9. *   and is provided to you solely for the purpose of assisting you in the    *
  10. *   development of your applications.  The code is provided "AS IS",         *
  11. *   without warranty of any kind.  IBM shall not be liable for any damages   *
  12. *   arising out of your use of the sample code, even if they have been       *
  13. *   advised of the possibility of such damages.                              *
  14. *****************************************************************************/
  15. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  16. /**************************************************************************   V1
  17. * C++ Hello World History and Key Functions:                              *   V1
  18. *   Version 1: (lines with V1 in column 79-80)                            *   V1
  19. *      - Creates and runs a simple application                            *   V1
  20. *      - Creates the main window (IFrameWindow)                           *   V1
  21. *      - Creates a static text control set to "Hello, World!!!" as the    *   V1
  22. *         client window                                                   *   V1
  23. *                                                                         *   V2
  24. *   Version 2: (lines with V2 in column 79-80)                            *   V2
  25. *      - Creates a main window (AHellowWindow) derived from IFrameWindow  *   V2
  26. *      - Gets the "Hello, World!!!" text string and other items from a    *   V2
  27. *         resource file                                                   *   V2
  28. *      - Sets the window title from a resource file                       *   V2
  29. *      - Creates and sets the information area below the client window    *   V2
  30. *                                                                         *   V3
  31. *   Version 3: (lines with V3 in column 79-80)                            *   V3
  32. *      - Adds alignment menu bar with left, center, and right menu items  *   V3
  33. *      - Adds command processing for aligning the                         *   V3
  34. *         "Hello, World!!!" text                                          *   V3
  35. *      - Places check mark in front of selected menu item                 *   V3
  36. *      - Creates and maintains current alignment status line              *   V3
  37. *                                                                         *   V4
  38. *   Version 4: (lines with V4 in column 79-80)                            *   V4
  39. *      - Adds accelerator keys for Left (F7), Center(F8), Right(F9)       *   V4
  40. *      - Modifies left, center and right menu items to show function keys *   V4
  41. *      - Modifies menu bar to create edit menu and "Text..." menu item    *   V4
  42. *      - Adds ADialogText to allow user to change "Hello, World!!!" text  *   V4
  43. *      - Adds push buttons to an ISetCanvas for changing text alignment   *   V4
  44. *                                                                         *   V5
  45. *   Version 5: (lines with V5 in column 79-80)                            *   V5
  46. *      - Uses a vertical split canvas as the client window                *   V5
  47. *      - Adds a horizontal split canvas as the left side of the client    *   V5
  48. *      - Adds the hello static text to the top of the horiz. split canvas *   V5
  49. *      - Adds a new control (AEarthWindow) using native graphics calls    *   V5
  50. *      - Adds AEarthWindow to the bottom of the horizontal split canvas   *   V5
  51. *      - Adds a list box to the right side of the vertical split canvas   *   V5
  52. *      - Adds help windows for the main, dialog, and entry field windows  *   V5
  53. **************************************************************************/
  54. //Include User Interface Class Library class headers:
  55. #ifndef _IBASE_                         //Make sure ibase.hpp is included
  56.   #include <ibase.hpp>                  //  since that is where IC_<environ>
  57. #endif                                  //  is defined.
  58. #include <iapp.hpp>                     //IApplication class                  V1
  59. #include <ifont.hpp>                    //IFont class                         V3
  60. #include <istring.hpp>                  //IString class                       V4
  61. #include <imsgbox.hpp>                  //IMessageBox class                   V5
  62.  
  63. #include "aearthw5.hpp"                 //AEarthWindow class                  V5
  64. #include "ahellow5.hpp"                 //Include AHelloWindow class headers  v5
  65. #include "ahellow5.h"                   //Include symbolic definitions        v5
  66. #include "adialog5.hpp"                 //Include ATextDialog class           v5
  67.  
  68. /**************************************************************************   V1
  69. * main  - Application entry point for Hello World Version 5.              *   v5
  70. *         This simple application does the following:                     *   V1
  71. *           1) Creates a new object mainWindow of class AHelloWindow      *   v2
  72. *           2) Sets Hello World window alignment                          *   V3
  73. *           3) Sets the size of mainWindow                                *   v3
  74. *           4) Sets the window focus to mainWindow                        *   v3
  75. *           5) Displays the mainWindow                                    *   v3
  76. *           6) Starts the events processing for the application           *   v3
  77. **************************************************************************/
  78. int main()                                                                  //V1
  79. {                                                                           //V1
  80.   AHelloWindow mainWindow (WND_MAIN);                                       //v2
  81.   mainWindow.setAlignment(AHelloWindow::left);                              //V3
  82.   mainWindow.sizeTo(ISize(400,300));                                        //V1
  83.   mainWindow.setFocus();                                                    //V1
  84.   mainWindow.show();                                                        //V1
  85.   IApplication::current().run();                                            //V1
  86.   return 0;
  87. } /* end main */                                                            //V1
  88.  
  89. /**************************************************************************   V2
  90. * AHelloWindow :: AHelloWindow - Constructor for the main window          *   V2
  91. * Construct the IFrameWindow using the default style plus minimizedIcon,  *   V2
  92. *   which gets the Icon identified in the resource file and associates it *   V2
  93. *   with the main window.  The accelerator style causes the accelerator   *   v4
  94. *   table to be loaded from the resource file.                            *   V4
  95. *  Create a menu bar object for the main window menu bar that was loaded  *   V3
  96. *    from the resource file.  menuBar is used by setAlignment to          *   V3
  97. *    manipulate check marks on the menu items.                            *   V3
  98. *  Create a static text object for displaying the status of the           *   V3
  99. *    Hello World text alignment.                                          *   V3
  100. *  Create the clientWindow split canvas to be used as the client window   *   V5
  101. *    of this frame and let its orientation default to vertical.           *   V5
  102. *  Create the helloCanvas split canvas making the clientWindow its parent *   V5
  103. *    window and orient it horizontally.                                   *   V5
  104. *  Create the hello and earthWindow static text objects as children of    *   v5
  105. *    the helloCanvas.  hello is placed in the topmost window of the       *   V5
  106. *    horizontal split canvas because it is created first.  earthWindow    *   V5
  107. *    is placed in the bottom window of the split canvas.                  *   V5
  108. *  Create the listBox window making the clientWindow its parent window    *   V5
  109. *    and enabling it for tabbing and preventing it from being resized     *   V5
  110. *    due to an item being too long.  helloCanvas is placed in the         *   V5
  111. *    leftmost window of the vertical split canvas because it is created   *   V5
  112. *    first.  listBox is placed in the right window of the split canvas.   *   V5
  113. *  Create a set canvas that will contain the push buttons and will be     *   V4
  114. *    added to the frame as an extension.                                  *   V4
  115. *  Create each push button with the set canvas as parent and owner.       *   V4
  116. *  Additionally for Help, specify help style and noPointerFocus style.    *   V5
  117. *    noPointerFocus prevents the mouse from changing the input focus      *   V5
  118. *    to the Help push button when you select it using the mouse.  This    *   V5
  119. *    allows you to use contextual help for the control with the input     *   V5
  120. *    focus rather than for the Help push button itself.                   *   V5
  121. *  Create the Hello World information area object from IInfoArea class.   *   V2
  122. *    The information area is automatically added as an extension below    *   V2
  123. *    the client window of the frame.                                      *   V2
  124. *  Create a command handler to process command events from menu item,     *   v4
  125. *    push button, and accelerator key selections.                         *   v4
  126. *  Create a select handler to process selections made in the list box.    *   V5
  127. *  Create an IHelpWindow object that is displayed when help is requested  *   V5
  128. *    from a help menu item, the help push button, or the help accelerator *   V5
  129. *    key, normally F1.                                                    *   V5
  130. *  An IHelpHandler object, helpHandler is created implicitly, see class   *   V5
  131. *    definition for AHelloWindow in ahellow5.hpp.                         *   V5
  132. **************************************************************************/ //V2
  133.  
  134. AHelloWindow :: AHelloWindow(unsigned long windowId)                        //V2
  135.   : IFrameWindow(IFrameWindow::defaultStyle() |                             //V2
  136.                  IFrameWindow::minimizedIcon  |                             //v4
  137.                  IFrameWindow::accelerator,                                 //V4
  138.                  windowId)                                                  //V2
  139.    ,menuBar(windowId, this)                                                 //V3
  140.    ,statusLine(WND_STATUS, this, this)                                      //V3
  141.    ,clientWindow(WND_CANVAS, this, this)                                    //V5
  142.    ,helloCanvas(WND_HCANVAS, &clientWindow, &clientWindow, IRectangle(),    //V5
  143.                 IWindow::visible | ISplitCanvas::horizontal)                //V5
  144.    ,hello(WND_HELLO, &helloCanvas, &helloCanvas)                            //v5
  145.    ,earthWindow(WND_EARTH, &helloCanvas)                                    //V5
  146.    ,listBox(WND_LISTBOX, &clientWindow, &clientWindow, IRectangle(),        //V5
  147.                 IListBox::defaultStyle() |                                  //V5
  148.                 IControl::tabStop |                                         //V5
  149.                 IListBox::noAdjustPosition)                                 //V5
  150.    ,buttons(WND_BUTTONS, this, this)                                        //V4
  151.    ,leftButton(MI_LEFT, &buttons, &buttons)                                 //V4
  152.    ,centerButton(MI_CENTER, &buttons, &buttons)                             //V4
  153.    ,rightButton(MI_RIGHT, &buttons, &buttons)                               //V4
  154.    ,helpButton(MI_HELP, &buttons, &buttons, IRectangle(),                   //V5
  155.                 IPushButton::defaultStyle() |                               //V5
  156.                 IPushButton::help | IButton::noPointerFocus)                //V5
  157.    ,infoArea(this)                                                          //V2
  158.    ,commandHandler(this)                                                    //V3
  159.    ,selectHandler(this)                                                     //V5
  160.    ,helpWindow(HELP_TABLE,this)                                             //V5
  161. {                                                                           //V2
  162.  
  163. /*------------------------- Setup the Client Window ----------------------|   V5
  164. |  Set the clientWindow split canvas as the client window for the         |   V5
  165. |    AHelloWorld frame.                                                   |   V5
  166. |  Set the HelloCanvas object to occupy 60% of the client canvas.         |   V5
  167. |  Set the list box object to occupy 40% of the client canvas.            |   V5
  168. |------------------------------------------------------------------------*/ //V5
  169.   setClient(&clientWindow);                                                 //V5
  170.   clientWindow.setSplitWindowPercentage(&helloCanvas, 60);                  //V5
  171.   clientWindow.setSplitWindowPercentage(&listBox, 40);                      //V5
  172.  
  173. /*------------------------- Setup the Status Line ------------------------|   V3
  174. |  Add the status line as an extension to the frame above the client      |   V3
  175. |    window with the height calculated from the maximum height of a       |   V3
  176. |    character in the current font.                                       |   V3
  177. |------------------------------------------------------------------------*/ //V3
  178.   addExtension(&statusLine, IFrameWindow::aboveClient,                      //V3
  179.                  IFont(&statusLine).maxCharHeight());                       //V3
  180.  
  181. /*-------------------------- Setup the List Box --------------------------|   V5
  182. |  Add the different language versions of Hello World to the list box in  |   V5
  183. |    ascending order.  Hello World text strings are stored in the         |   V5
  184. |    resource file with IDs beginning with HI_WORLD with each subsequent  |   V5
  185. |    ID incremented up to HI_WORLD + HI_COUNT - 1.                        |   V5
  186. |  Have the select handler handle selections made in the list box.        |   V5
  187. |    The select handler's selected() function is called to process        |   V5
  188. |    list box selections.                                                 |   V5
  189. |------------------------------------------------------------------------*/ //V5
  190.   for (int i=0;i<HI_COUNT;i++ )                                             //V5
  191.      listBox.addAscending(HI_WORLD+i);                                      //V5
  192.   selectHandler.handleEventsFor(&listBox);                                  //V5
  193.  
  194. /*---------------------- Setup the Information Area ----------------------|   V5
  195. |  Change the size of the information area using the maximum height of    |   V5
  196. |    a character in the current font.                                     |   V5
  197. |------------------------------------------------------------------------*/ //V5
  198.   setExtensionSize(&infoArea, IFont(&infoArea).maxCharHeight());            //V5
  199.  
  200. /*---------------------------- Set Text Values ---------------------------|   V2
  201. |  Set the values for the text controls from strings in the resource file.|   V2
  202. |    The infoArea inactive text is displayed when no menu item is active. |   V2
  203. |------------------------------------------------------------------------*/ //V2
  204.   hello.setText(STR_HELLO);                                                 //V2
  205.   leftButton.setText(STR_LEFTB);                                            //V4
  206.   centerButton.setText(STR_CENTERB);                                        //V4
  207.   rightButton.setText(STR_RIGHTB);                                          //V4
  208.   helpButton.setText(STR_HELPB);                                            //V5
  209.   infoArea.setInactiveText(STR_INFO);                                       //V2
  210.  
  211. /*------------------- Setup Push Buttons Set Canvas ----------------------|   V4
  212. |  Enable the first button as a tab stop.                                 |   V4
  213. |  Set the canvas margins and padding between buttons to zero.            |   V4
  214. |  Add the set canvas that contains the push buttons to the frame window  |   V4
  215. |    as an extension immediately below the client window with a height    |   V4
  216. |    equal to the minimum height of the push buttons.  You must set the   |   V4
  217. |    text in the push buttons first.                                      |   V4
  218. |------------------------------------------------------------------------*/ //V4
  219.   leftButton.enableTabStop();                                               //V4
  220.   buttons.setMargin(ISize());                                               //V4
  221.   buttons.setPad(ISize());                                                  //V4
  222.   addExtension(&buttons, IFrameWindow::belowClient,                         //V4
  223.                 (unsigned long)buttons.minimumSize().height());             //V4
  224.  
  225. /*----------------------- Setup the Command Handler ----------------------|   V3
  226. |  Have the command handler handle commands sent from the frame window.   |   V3
  227. |    The command handler's command() function is called to process        |   V3
  228. |    menu item, push button, and accelerator key selections.              |   v5
  229. |------------------------------------------------------------------------*/ //V3
  230.   commandHandler.handleEventsFor(this);                                     //V3
  231.  
  232. /*---------------------------- Setup Help --------------------------------|   V5
  233. |   Add the help library to the help window using addLibraries().         |   V5
  234. |   Set the help window title from a string in the resource file.         |   V5
  235. |   Begin handling help events for the frame window.                      |   V5
  236. |------------------------------------------------------------------------*/ //V5
  237.    try                                                                      //V5
  238.    {                                                                        //V5
  239.       helpWindow.addLibraries( "ahellow5.hlp" );                            //V5
  240.       helpWindow.setTitle(STR_HTITLE);                                      //V5
  241.       helpHandler.handleEventsFor(this);                                    //V5
  242.    }                                                                        //V5
  243.    catch( ... )                                                             //V5
  244.    {                                                                        //V5
  245.       IMessageBox                                                           //V5
  246.          msgBox( this );                                                    //V5
  247.       msgBox.show( STR_HELP_NOT_FOUND, IMessageBox::warning );              //V5
  248.    }                                                                        //V5
  249.  
  250. /*----------------------- Set Default Alignment --------------------------|   V2
  251. | Align the static text, set the status line, and set the check mark in   |   v3
  252. |   the menu bar.                                                         |   v3
  253. |------------------------------------------------------------------------*/ //V2
  254.   setAlignment(center);                                                     //v3
  255.  
  256. } /* end AHelloWindow :: AHelloWindow(...) */                               //V2
  257.  
  258. /**************************************************************************   V3
  259. * AHelloWindow :: ~AHelloWindow - Destructor for the main window          *   V3
  260. *   Stop handling command events for the frame.                           *   V3
  261. *   Stop handling select events for the list box.                         *   V5
  262. *   Stop handling help events for the frame.                              *   V5
  263. **************************************************************************/ //V3
  264. AHelloWindow :: ~AHelloWindow()                                             //V3
  265. {                                                                           //V3
  266.   commandHandler.stopHandlingEventsFor(this);                               //V3
  267.   selectHandler.stopHandlingEventsFor(&listBox);                            //V5
  268.   helpHandler.stopHandlingEventsFor(this);                                  //V5
  269.  
  270. } /* end AHelloWindow :: ~AHelloWindow() */                                 //V3
  271.  
  272. /**************************************************************************   V3
  273. * AHelloWindow :: setAlignment - Align static text in client window       *   V3
  274. **************************************************************************/ //V3
  275. AHelloWindow &                                                              //V3
  276.   AHelloWindow :: setAlignment(Alignment alignment)                         //V3
  277. {                                                                           //V3
  278. /*--------------------- Update Window for New Alignment ------------------|   V3
  279. |  Depending on the value passed, update the window as follows:           |   V3
  280. |    Set the alignment of the static text control in the client window.   |   V3
  281. |    Set the text of the alignment status line static text control.       |   V3
  282. |    Check the selected menu item; remove check marks from the other two. |   V3
  283. |------------------------------------------------------------------------*/ //V3
  284.   switch(alignment)                                                         //V3
  285.   {                                                                         //V3
  286.   case left:                                                                //V3
  287.     hello.setAlignment(                                                     //V3
  288.      IStaticText::centerLeft);                                              //V3
  289.     statusLine.setText(STR_LEFT);                                           //V3
  290.     menuBar.uncheckItem(MI_CENTER);                                         //V3
  291.     menuBar.checkItem(MI_LEFT);                                             //V3
  292.     menuBar.uncheckItem(MI_RIGHT);                                          //V3
  293.     break;                                                                  //V3
  294.   case center:                                                              //V3
  295.     hello.setAlignment(                                                     //V3
  296.       IStaticText::centerCenter);                                           //V3
  297.     statusLine.setText(STR_CENTER);                                         //V3
  298.     menuBar.checkItem(MI_CENTER);                                           //V3
  299.     menuBar.uncheckItem(MI_LEFT);                                           //V3
  300.     menuBar.uncheckItem(MI_RIGHT);                                          //V3
  301.     break;                                                                  //V3
  302.  case right:                                                                //V3
  303.     hello.setAlignment(                                                     //V3
  304.       IStaticText::centerRight);                                            //V3
  305.     statusLine.setText(STR_RIGHT);                                          //V3
  306.     menuBar.uncheckItem(MI_CENTER);                                         //V3
  307.     menuBar.uncheckItem(MI_LEFT);                                           //V3
  308.     menuBar.checkItem(MI_RIGHT);                                            //V3
  309.     break;                                                                  //V3
  310.  }                                                                          //V3
  311.  return (*this);                        //Return a reference to the frame     V3
  312.  
  313. } /* end AHelloWindow :: setAlignment(...) */                               //V3
  314.  
  315. /**************************************************************************   V4
  316. * AHelloWindow :: editText                                                *   V4
  317. *   Create and show a dialog window for inputting text that will be used  *   V4
  318. *   to replace the "Hello World!!!" static text string.                   *   V4
  319. **************************************************************************/ //V4
  320. AHelloWindow &                                                              //V4
  321.   AHelloWindow :: editText()                                                //V4
  322. {                                                                           //V4
  323. /*----------------------- Setup for Displaying Dialog --------------------|   V4
  324. |  Store the current value of the text to be changed.                     |   V4
  325. |  Set the text in the information area from the dialog information       |   V4
  326. |    string in the resource file.                                         |   V4
  327. |------------------------------------------------------------------------*/ //V4
  328.   IString textValue(hello.text());                                          //V4
  329.   infoArea.setInactiveText(STR_INFODLG);                                    //V4
  330.  
  331. /*------------------------ Create and Show Dialog ------------------------|   V4
  332. |  Create a new text dialog with textValue as the string to edit and      |   V4
  333. |    AHelloWindow as the owner window.                                    |   V4
  334. |  Show the dialog modally.  This means that the owner window cannot have |   V4
  335. |    the focus back until the dialog is ended.                            |   V4
  336. |------------------------------------------------------------------------*/ //V4
  337.   ATextDialog textDialog(textValue,this);                                   //V4
  338.   textDialog.showModally();                                                 //V4
  339.  
  340. /*------------------------ Process Dialog Result -------------------------|   V4
  341. |  If the OK button was used to end the dialog, then the static text,     |   V4
  342. |    hello, is set to the textValue string.  Else, it is not changed.     |   V4
  343. |  Reset the information area inactive text.                              |   V4
  344. |------------------------------------------------------------------------*/ //V4
  345.   if (textDialog.result() == DID_OK)                                        //V4
  346.         hello.setText(textValue);                                           //V4
  347.   infoArea.setInactiveText(STR_INFO);                                       //V4
  348.  
  349.   return (*this);                       //Return a reference to the frame     V4
  350. }  /* end AHelloWindow :: editText() */                                     //V4
  351.  
  352. /**************************************************************************   V5
  353. * AHelloWindow :: setTextFromListBox                                      *   V5
  354. *   Public function used by non-AHelloWindow functions to set the Hello   *   V5
  355. *   World text from the first selected item in the AHelloWindow listBox.  *   V5
  356. **************************************************************************/ //V5
  357. AHelloWindow &                                                              //V5
  358.   AHelloWindow :: setTextFromListBox()                                      //V5
  359. {                                                                           //V5
  360.  
  361. /*---------------------- Set Hello Text from ListBox ---------------------|   V5
  362. |  Create a cursor to the list box.  Using the default filter for a       |   V5
  363. |    list box cursor, selectedItems, causes the setToFirst() function     |   V5
  364. |    to position the cursor to the first selected item.                   |   V5
  365. |  Set the hello IStaticText control text value.                          |   V5
  366. |------------------------------------------------------------------------*/ //V5
  367.   IListBox::Cursor lbCursor(listBox);                                       //V5
  368.   lbCursor.setToFirst();                                                    //V5
  369.   hello.setText(listBox.elementAt(lbCursor));                               //V5
  370.  
  371.   return (*this);                       //Return a reference to the frame     V5
  372. }  /* end AHelloWindow :: setTextFromListBox() */                           //V5
  373.  
  374. /**************************************************************************   V3
  375. * ACommandHandler :: ACommandHandler - constructor for the command handler*   V3
  376. *       Construct the command handler from a pointer to the AHelloWindow  *   V3
  377. *       that events will be handled for.                                  *   V3
  378. **************************************************************************/ //V3
  379. ACommandHandler :: ACommandHandler(AHelloWindow *helloFrame)                //V3
  380. {                                                                           //V3
  381.    frame=helloFrame;                     //Save frame to be handled           V3
  382. } /* end ACommandHandler :: ACommandHandler(...) */                         //V3
  383.  
  384. /**************************************************************************   V3
  385. * ACommandHandler :: command                                              *   V3
  386. *   Handle menu and button commands                                       *   V4
  387. **************************************************************************/ //V3
  388. IBase::Boolean                                                              //V3
  389.   ACommandHandler :: command(ICommandEvent & cmdEvent)                      //V3
  390. {                                                                           //V3
  391.   Boolean eventProcessed(true);         //Assume event will be processed      V3
  392.  
  393. /*--------------------- Process command events ---------------------------|   V3
  394. |  Depending on the command event ID, call the AHelloWindow::setAlignment |   V3
  395. |    function with the appropriate AHelloWorld::Alignment value.          |   V3
  396. |  Do this except when the Text menu item is selected;                    |   V4
  397. |    then call the AHelloWindow::editText function for changing the       |   V4
  398. |    Hello World text using a dialog.                                     |   V4
  399. |------------------------------------------------------------------------*/ //V3
  400.   switch (cmdEvent.commandId()) {                                           //V3
  401.     case MI_CENTER:                                                         //V3
  402.       frame->setAlignment(AHelloWindow::center);                            //V3
  403.       break;                                                                //V3
  404.     case MI_LEFT:                                                           //V3
  405.       frame->setAlignment(AHelloWindow::left);                              //V3
  406.       break;                                                                //V3
  407.     case MI_RIGHT:                                                          //V3
  408.       frame->setAlignment(AHelloWindow::right);                             //V3
  409.       break;                                                                //V3
  410.     case MI_TEXT:                                                           //V4
  411.       frame->editText();                                                    //V4
  412.       break;                                                                //V4
  413.  
  414.     default:                            //Otherwise,                          V3
  415.       eventProcessed=false;             //  the event wasn't processed        V3
  416.   } /* end switch */                                                        //V3
  417.  
  418.   return(eventProcessed);                                                   //V3
  419. } /* end ACommandHandler :: command(...) */                                 //V3
  420.  
  421. /**************************************************************************   V5
  422. * ASelectHandler :: ASelectHandler - constructor for the select handler   *   V5
  423. *       Construct the select handler from a pointer to the AHelloWindow   *   V5
  424. *       that will be changed as a result of the selection.                *   V5
  425. **************************************************************************/ //V5
  426. ASelectHandler :: ASelectHandler(AHelloWindow *helloFrame)                  //V5
  427. {                                                                           //V5
  428.    frame=helloFrame;                     //Save frame to be handled           V5
  429. } /* end ASelectHandler :: ASelectHandler(...) */                           //V5
  430.  
  431.  
  432. /**************************************************************************   V5
  433. * ASelectHandler :: selected                                              *   V5
  434. *   Handle items selected within the list box.                            *   V5
  435. **************************************************************************/ //V5
  436. IBase::Boolean                                                              //V5
  437.   ASelectHandler :: selected(IControlEvent & evt)                           //V5
  438. {                                                                           //V5
  439.  
  440. /*---------------------- Call AHelloWindow Function ----------------------|   V5
  441. |  Call the AHelloWindow::setTextFromListBox function for the frame used  |   V5
  442. |    to construct this select handler.                                    |   V5
  443. |------------------------------------------------------------------------*/ //V5
  444.   frame->setTextFromListBox();                                              //V5
  445.  
  446.   return (true);                        //Event is always processed           V5
  447. } /* end ASelectHandler :: selected(...) */                                 //V5
  448.  
  449. /**************************************************************************   V5
  450. * AHelpHandler :: keysHelpId                                              *   V5
  451. *   Handle the keys help request event                                    *   V5
  452. *   This overrides the default action of setting the event result to      *   V5
  453. *     zero, which indicates that no action is required, that is, no       *   V5
  454. *     help information for keys is displayed.                             *   V5
  455. **************************************************************************/ //V5
  456. IBase::Boolean                                                              //V5
  457.   AHelpHandler :: keysHelpId(IEvent& evt)                                   //V5
  458. {                                                                           //V5
  459.   evt.setResult(1000);                  //1000=keys help ID in                V5
  460.                                         //  ahellow5.ipf file                 V5
  461.  
  462.   return (true);                        //Event is always processed           V5
  463. } /* end AHelpHandler :: keysHelpId(...) */                                 //V5
  464.