home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / CONTRIB / MBASE / MBASE50.TAR / mbase / sample / sample.frm < prev    next >
Encoding:
Text File  |  1992-11-21  |  4.0 KB  |  99 lines

  1. #
  2. # This is form sample--designed as a demonstration data-entry form.  It
  3. # must be compiled with 'form'; sample_fm.h (built from this by form) is used
  4. # in sample.c to control data-entry.
  5. #
  6. # Released October 1st, 1992 by Huan-Ti [ virtual!root@owlnet.rice.edu ]
  7. #                                       [ t-richj@microsoft.com ]
  8. #
  9.  
  10. Data sample;
  11.  
  12. Define A credit;    # These names are too long for their DE slots,
  13. Define B temp;      # So they're defined to something shorter.
  14. Define C num
  15.  
  16. #
  17. # Oh yeah.  I added the line below for Number Purchased on a whim... you'll
  18. # find no mention of it in sample.c; but it works just perfectly, data moving
  19. # from data-entry template to the relation and back without any specific
  20. # coding at all.  Good example of some hefty flexibility here...
  21. #
  22. # The "4 2" below are the Y,X coordinates of the upper-left corner of this
  23. # data-entry template on the screen.  Just thought I'd mention that.
  24. #
  25.  
  26. Screen 2 2
  27. {
  28.      +--------------------------------------------------------------+
  29.      |                                                              |
  30.      |  Customer Number...[custnum]   Name...[custname           ]  |
  31.      |  Customer Phone....[phone               ]                    |
  32.      |                                                              |
  33.      |  Current Balance...${balance  }  Accept Credit...[A]..[B    ]  |
  34.      |  Number Purchased..[C  ]                                     |
  35.      |                                                              |
  36.      |  Date Entered......[date_en   ]  Time...[time_en ]           |
  37.      |                                                              |
  38.      +--------------------------------------------------------------+
  39.  
  40.             Ctrl-U          -  Undo (in this field only)
  41.             Ctrl-Q, Ctrl-C  -  Abort a change
  42.             Ctrl-A, Ctrl-D  -  Accept transaction; Delete this record
  43.             Ctrl-N, Ctrl-P  -  Find next record; Find previous record
  44.  
  45.       Type CTRL-Q (to leave edit mode), then "new" as a customer name
  46.             to add a new record.
  47. }
  48.  
  49. #
  50. # Note the screwed-up right side on the template above.  The braces
  51. # surrounding "balance" will be actually -removed- from the display, while
  52. # the brackets around the others are simply spaced over.  So the template
  53. # looks perfectly rectangular during data-entry.
  54. #
  55. # I only used braces because I wanted the number for the customer's balance
  56. # to buck right up against the dollar sign.  I know--picky picky...
  57. #
  58.  
  59. Field credit type choice ("Yy" "Nn" "?");
  60. Field temp   type link to credit ("Yes" "No" "Maybe");
  61.  
  62. #
  63. # Ah.  The two lines above create a choice-and-link pair... something I
  64. # noticed I'd been writing a lot of hard-coded a while back, and decided to
  65. # support.  Without the "Field temp type link to credit..." thing, the
  66. # field "sample.credit" would continue to work as you'd expect from a choice
  67. # field--it only allows characters from the set "YyNn?" in it.  But, add the
  68. # link to credit, and field "temp" is filled in automatically depending on
  69. # what "sample.credit" is:  "Yy" maps to "Yes", "Nn" to "No", and "?" to
  70. # "Maybe".
  71. #
  72. # Note that, an alternate setup (if the relation had sample.credit defined
  73. # to have a few more characters) might be:
  74. #
  75. # Field temp   type choice ("Yy" "Nn" "?");
  76. # Field credit type link to temp ("Yes" "No" "Maybe");
  77. #
  78. #    Accept Credit?....[temp]..[credit ]
  79. #
  80. # That way, the Yes/No/Maybe is stored in the relation, instead of Y/N/?.
  81. # Nifty, eh?  Links can only be made to choice fields, and choices need not
  82. # have links.  A field can't be both a link and a choice, nor can a single
  83. # field be a link to more than one choice field... but a choice field can
  84. # have multiple links.  Confused yet?  Play with it.
  85. #
  86.  
  87. Mode 1 inout  custnum out,   temp out, date_en out, time_en  out; # Add
  88. Mode 2 out    custnum inout, custname inout;                      # Query
  89. Mode 3 inout                 temp out, date_en out, time_en  out; # Update
  90.  
  91. #
  92. # Mode 1 is for adding new records,
  93. # Mode 2 is for finding old records,
  94. # Mode 3 is for updating existing records.
  95. #
  96.  
  97. End
  98.  
  99.