home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 10.ddi / STEPS.ZIP / HELPWIND.CPP next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  5.2 KB  |  168 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <dos.h>
  6. #include <string.h>
  7. #include <owl.h>
  8. #include <static.h>
  9. #include <edit.h>
  10. #include <listbox.h>
  11. #include <button.h>
  12. #include "helpwind.h"
  13.  
  14. THelpWindow::THelpWindow(PTWindowsObject AParent) :
  15.    TWindow(AParent, "Help System")
  16. {
  17.   DisableAutoCreate();
  18.   Attr.Style |= WS_POPUPWINDOW | WS_CAPTION;
  19.   Attr.X = 100;
  20.   Attr.Y = 100;
  21.   Attr.W = 300;
  22.   Attr.H = 300;
  23.   ListBox = new TListBox(this, ID_LISTBOX, 20, 20, 180, 80);
  24.   new TButton(this, ID_BUTTON1, "Help", 220, 20, 60, 30, TRUE);
  25.   new TButton(this, ID_BUTTON2, "Cancel", 220, 70, 60, 30, FALSE);
  26.   Edit = new TEdit(this, ID_EDIT, "", 20, 180, 260, 90, 40, TRUE);
  27.   new TStatic(this, -1, "Help Information:", 20, 160, 160, 20, 0);
  28. }
  29.  
  30. void THelpWindow::SetupWindow()
  31. {
  32.   TWindow::SetupWindow();
  33.   ListBox->AddString("List Boxes");
  34.   ListBox->AddString("Buttons");
  35.   ListBox->AddString("Check Boxes");
  36.   ListBox->AddString("Radio Buttons");
  37.   ListBox->AddString("Group Boxes");
  38.   ListBox->AddString("Scroll Bars");
  39.   ListBox->AddString("Edit Controls");
  40.   ListBox->AddString("Static Controls");
  41.   ListBox->AddString("Combo Boxes");
  42.   ListBox->SetSelIndex(0);
  43. };
  44.  
  45. void THelpWindow::HandleListBoxMsg(RTMessage Msg)
  46. {
  47.   char SelString[25];
  48.  
  49.   if ( Msg.LP.Hi == LBN_DBLCLK )
  50.   {
  51.     ListBox->GetSelString(SelString, sizeof(SelString));
  52.     FillEdit(SelString);
  53.   }
  54. }
  55.  
  56. void THelpWindow::HandleButton1Msg(RTMessage)
  57. {
  58.   char SelString[25];
  59.  
  60.   ListBox->GetSelString(SelString, sizeof(SelString));
  61.   FillEdit(SelString);
  62. }
  63.  
  64. void THelpWindow::HandleButton2Msg(RTMessage)
  65. {
  66.   CloseWindow();
  67. }
  68.  
  69. void THelpWindow::FillEdit(Pchar SelString)
  70. {
  71.   Pchar HelpStr;
  72.  
  73.   if ( strcmp(SelString, "Buttons") == 0 )
  74.   {  HelpStr =
  75.        "Button controls are used to allow\r\n"
  76.        "the user to enter a command.  The\r\n"
  77.        "user \"presses\" a button by clicking\r\n"
  78.        "upon it with the mouse.  Button\r\n"
  79.        "controls display a text string which\r\n"
  80.        "indicates the action performed when\r\n"
  81.        "the button is pressed.";
  82.   };
  83.   if ( strcmp(SelString, "Check Boxes") == 0 )
  84.   {  HelpStr =
  85.        "Check boxes are used to represent\r\n"
  86.        "an option which may be selected by\r\n"
  87.        "the user.  The user clicks upon the\r\n"
  88.        "check box to toggle its check state.\r\n"
  89.        "Check boxes are often displayed\r\n"
  90.        "within a group box.  Normally, any\r\n"
  91.        "number of check boxes in a group\r\n"
  92.        "may be selected, simultaneously.";
  93.   }
  94.   if ( strcmp(SelString, "Radio Buttons") == 0 )
  95.   {  HelpStr =
  96.        "Radio Buttons are used to represent\r\n"
  97.        "an option which may be selected by\r\n"
  98.        "the user, by clicking upon it.  Radio\r\n"
  99.        "buttons are usually displayed within\r\n"
  100.        "a group box, and normally are\r\n"
  101.        "mutually exclusive options.";
  102.   };
  103.   if ( strcmp(SelString, "Group Boxes") == 0 )
  104.   {  HelpStr =
  105.        "Group boxes are rectangular\r\n"
  106.        "controls normally used to group\r\n"
  107.        "check boxes and radio buttons.  See\r\n"
  108.        "\"Check Boxes\" and \"Radio Button\"\r\n"
  109.        "HELP information.";
  110.   };
  111.   if ( strcmp(SelString, "List Boxes") == 0 )
  112.   {  HelpStr =
  113.        "List boxes are used to retrieve user\r\n"
  114.        "input in the form of a selection of a\r\n"
  115.        "text item from a list.  The user\r\n"
  116.        "selects an item in the list by single-\r\n"
  117.        "or double- clicking upon it.";
  118.   };
  119.   if ( strcmp(SelString, "Scroll Bars") == 0 )
  120.   {  HelpStr =
  121.        "Scroll bar controls are used to\r\n"
  122.        "retrieve a value in a particular\r\n"
  123.        "range.  The user inputs a value by\r\n"
  124.        "moving a sliding box (a \"thumb\")\r\n"
  125.        "along the scroll bar.  The position\r\n"
  126.        "of the box represents the input\r\n"
  127.        "value.";
  128.   };
  129.   if (strcmp(SelString, "Edit Controls") == 0 )
  130.   {  HelpStr =
  131.        "This is an edit control.  An edit\r\n"
  132.        "control is used to retrieve text\r\n"
  133.        "input from a user.  The user can\r\n"
  134.        "enter and modify text in the edit\r\n"
  135.        "control using the mouse and the\r\n"
  136.        "keyboard.  An edit control often\r\n"
  137.        "contains default text input when\r\n"
  138.        "initially displayed.";
  139.   };
  140.   if ( strcmp(SelString, "Static Controls") == 0 )
  141.   {  HelpStr =
  142.        "Static controls are simple text items\r\n"
  143.        "that are displayed in a window.\r\n"
  144.        "Unlike most other types of controls,\r\n"
  145.        "static controls cannot be modified\r\n"
  146.        "by the user. They are often used in\r\n"
  147.        "combination with other controls to\r\n"
  148.        "display information to guide user\r\n"
  149.        "input.";
  150.   };
  151.   if ( strcmp(SelString, "Combo Boxes") == 0 )
  152.   {  HelpStr =
  153.        "Combo boxes provide the function-\r\n"
  154.        "ality of both list boxes and edit\r\n"
  155.        "controls. They are used to retrieve\r\n"
  156.        "user input in the form of either a\r\n"
  157.        "selection of a text item from a list\r\n"
  158.        "or as text input into the edit control.\r\n"
  159.        "The user has the option of selecting\r\n"
  160.        "a listed item or typing in an item not\r\n"
  161.        "listed.";
  162.   };
  163.   Edit->SetText(HelpStr);
  164. }
  165.  
  166.  
  167.  
  168.