home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / TCXOS2.ZIP / DEMO / MID_DEMO.C < prev    next >
Text File  |  1991-11-05  |  6KB  |  125 lines

  1. /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
  2.  | Copyright (c) 1987-1991, Innovative Data Concepts, Inc.
  3.  | All Rights Reserved.
  4.  |
  5.  | This Library is part of IDC's TesSeRact Development Tools product
  6.  | line. For information about other IDC products, call  1-215-443-9705.
  7.  *-V--------------------------------------------------------------------*
  8.  | $Header:   mid_demo.c     552.0   17 Mar 1991 18:28:24  $
  9.  |
  10.  | $Log:   mid_demo.c    $
  11.  *-D--------------------------------------------------------------------*
  12.  | Mid_Demo.C : TCXL Middle-level Demonstration Program.
  13.  |
  14.  | Syntax:  MID_DEMO [-switches]
  15.  |
  16.  |    -c  = CGA snow elimination
  17.  |    -b  = BIOS screen writing
  18.  |    -m  = force monochrome text attributes
  19.  *-N-----------------------[ Notes and Caveats ]------------------------*
  20.  | 1) Also requires Str_Demo.C, Win_Demo.C and DemoMisc.C.
  21.  | 2) Use the MakeDemo.Bat file to compile this program.
  22.  *======================================================================*/
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include "demo\TCXLdemo.h"             /* TCXL demo-specific            */
  26.  
  27. /*----------------------------[ Global data ]---------------------------*/
  28.  
  29. IntT  CDC   LeftRow, LeftCol;          /* main menu coords              */
  30. IntT  CDC   RightRow, RightCol;
  31. IntT  CDC   DemoFast = 0;              /* window delay flag             */
  32.  
  33. /*----------------------------[ Local data ]----------------------------*/
  34.  
  35. LCL   ChrT  CDC   date[7], phone[11], ssan[10]; /* input demo fields    */
  36.  
  37. /*-----------[ Main menu item-build and menu-build objects ]------------*
  38.  | Elements for each item IbldT are:
  39.  |    istr, ichr, imsk, irow, icol, itag, ihlp, ikey, iusr,
  40.  |    ibef, isel, iaft, itxt, isub
  41.  | Elements for the menu MbldT are:
  42.  |    mitm, mcnt, mbgr, mbgc, menr, menc, mtyp, mfrt, mfra,
  43.  |    mwat, mtat, msat, mnat, mbat,
  44.  |    mtag, mopn, musr, mwid, mofs, mdtr, mdtc, mdat
  45.  | The structures are defined in <TCXLmnu.h>.
  46.  *----------------------------------------------------------------------*/
  47.  
  48. LCL   IbldT CDC   Mid_Itm[5] =         /*- Main Menu Items -------------*/
  49. {  {  "Window System",  'W', 0, 0, 0, 1, H_WINDOWING, 0, 0,
  50.       NULL, WinDemo,    NULL, NULL, NULL  },
  51.    {  "Input System",   'I', 0, 1, 0, 2, H_INPUT,     0, 0,
  52.       NULL, InputDemo,  NULL, NULL, NULL  },
  53.    {  "Strings System", 't', 0, 2, 0, 3, H_STRINGS,   0, 0,
  54.       NULL, StringDemo, NULL, NULL, NULL  },
  55.    {  "Information",    'n', 0, 3, 0, 4, H_NONE,      0, 0,
  56.       NULL, TcxlInfo,   NULL, NULL, NULL  },
  57.    {  "Exit demo",      'x', 0, 4, 0, 5, H_NONE,      0, 0,
  58.       NULL, NULL,       NULL, NULL, NULL  }
  59. };
  60. LCL   MbldT CDC   Mid_Mnu =            /*- Main menu -------------------*/
  61. {  &Mid_Itm[0], 5,  0,  0,  0,  0, MNU_VER, BOX_SNG, LBLUE|_BLUE,
  62.    LBLUE|_BLUE, LCYAN|_BLUE, WHITE|_BLUE, 0, BLUE|_LGREY,
  63.    1, PreMenu1,  0, 19, 1, 0xFF, 0xFF, 0xFF
  64. };
  65.  
  66. /*================[ The TCXL Middle-Level Demo Program ]================*/
  67.  
  68. IntT CDC main(IntT argc, ChrP argv[])
  69. {
  70.    Initialize();                       /* initialize for demo           */
  71.    ParseCmdLine(argc, argv);           /* parse command-line switches   */
  72.    OpenBkgrnd();                       /* display opening screen        */
  73.    Mid_Mnu.mbgr = MsByt(LeftRow);      /* set main-menu position        */
  74.    Mid_Mnu.mbgc = MsByt(LeftCol);
  75.    Mid_Mnu.menr = MsByt(RightRow);
  76.    Mid_Mnu.menc = MsByt(RightCol);
  77.    MainMenu(&Mid_Mnu);                 /* display/process main menu     */
  78.    NormalExit();                       /* exit normally                 */
  79.    return(0);                          /* *** never executed ***        */
  80. }  /* main() */
  81.  
  82. /*=========================[ Input-system demo ]========================*
  83.  | Called from the [I]nput mani menu item
  84.  *----------------------------------------------------------------------*/
  85.  
  86. VOID  CTYP  InputDemo(NOARG)
  87. {
  88.    VcelFP   s;
  89.  
  90.    s = FarVsave(LGREY|_BLUE);          /* save the screen               */
  91.    CurSave();                          /* save cursor state             */
  92.    if(!WpopUp(CNT_CNT, 5, 21, 15,      /* pop up the demo window        */
  93.       58, 3, LGREEN|_MAGENTA, LGREEN|_MAGENTA))
  94.       ErrorExit(1);                    /* windowing error!              */
  95.  
  96.    Wtitle("[ Single-Line Input ]",     /* add a title                   */
  97.       TTL_CNT, LGREEN|_MAGENTA);
  98.    HlpSet(H_DATAENTRY);                /* set help category             */
  99.    AddShadow();                        /* add a shadow                  */
  100.    WsetTxt(WHITE|_MAGENTA);            /* text attribute                */
  101.    if(KwGetFmt(phone,                  /* phone-number field            */
  102.          "'\n\n  Phone Number?    "
  103.          "'!R--!'('!+!###!-!') '!+!###!-!'-'!+!####"))
  104.       ConfirmQuit();                   /* check user response           */
  105.    WsetTxt(WHITE|_MAGENTA);            /* text attribute                */
  106.  
  107.    if(KwGetFmt(ssan,                   /* social security number field  */
  108.          "'\n\n  Soc Sec Number?  "
  109.          "'!R-!<01234567>##!-!'-'!+!##!-!'-'!+!####"))
  110.       ConfirmQuit();                   /* check user response           */
  111.    WsetTxt(WHITE|_MAGENTA);            /* text attribute                */
  112.  
  113.    if(KwGetFmt(date,                   /* date field                    */
  114.          "\"\n\n  Today's Date?    "
  115.           "\"!R-!<01>#!-!'/'!+!<0123>#!-!'/'!+!'19'##"))
  116.       ConfirmQuit();                   /* check user response           */
  117.    Wclose();                           /* close the window              */
  118.    CurPop();                           /* restore original cursor state */
  119.    FarVrestore(s);                     /* restore the screen            */
  120.    KeyClear();                         /* flush any lurking keys        */
  121.    MoveBarDn();                        /* select next main menu item    */
  122. }  /* InputDemo() */
  123. /*- end of Mid_Demo.c --------------------------------------------------*/
  124.  
  125.