home *** CD-ROM | disk | FTP | other *** search
/ TestDrive Super Store 3.0 / TESTDRIVE_3.ISO / realizer / formdev / mainform.rlz < prev    next >
Encoding:
Text File  |  1992-09-30  |  3.8 KB  |  158 lines

  1. '***********************************************************************
  2. '    FormDev: MainForm.RLZ
  3. '
  4. '    Copyright ⌐ 1991-1992 Computer Associates International, Inc.
  5. '    All rights reserved.
  6. '
  7. '***********************************************************************
  8.  
  9. PROC MainFormNew
  10.     LOCAL    v
  11.  
  12.     theform.type = 50
  13.     theform.name = "MyForm"
  14.     theform.title = "Form1"
  15.     theform.bgcolor = _White
  16.     theform.init = ""
  17.     theform.units = 1        'pixels
  18.     theform.itemunits = 1    'same
  19.     theform.style = _Close + _Minimize + _Title + _Size
  20.     theform.saveflags = 8
  21.     theform.bitmapdir = ""
  22.     theform.linkdir = ""
  23.  
  24. FormNew(fdMain)
  25. FormControl(_Size; 85/640, 20/442, 475/640, 375/442)
  26. v = FormQ(_Size)
  27. FormControl(_Close)
  28.     theform.left = v[1]
  29.     theform.top = v[2]
  30.     theform.width = v[3]
  31.     theform.height = v[4]
  32.  
  33.     theform.font = 0
  34.     theform.fldC = ColorPack(_White)
  35.     theform.txtC = ColorPack(_Black)
  36.  
  37.     SetupPaths
  38.     viewForm = 1
  39.  
  40.     fdNumItems = 0
  41.     fdNextItem = 10
  42.     fdChanged = 0
  43.     InitFonts    
  44.     CLEAR item
  45. END PROC
  46.  
  47.  
  48. PROC MainFormCreate
  49.     FormNew(fdMain; theform.title, BitAnd(theform.style, _ALL - _HotClick - _Close) + _HotClick)
  50.     FormSetColor(theform.bgcolor; _Background)
  51.     FormSetColor(theform.bgcolor; _Field)
  52.     FormSetColor(theform.bgcolor; _Text)
  53.     FormSetObject(32767, _Bitmap, QSys(_ProgDir) + "White", 0, 0, 15in, 15in)
  54.     FormSetObject(32766, _GroupBox, "", 0, 0, 15in, 15in)
  55.     FormModifyObject(32766, _Gray)
  56.     FormSetColor(_White; _Field)
  57.     FormSetColor(_Black; _Text)
  58.     FormSetProc(MainProc)
  59.  
  60.     FormControl(_Size; theform.left pxl, theform.top pxl, theform.width pxl, theform.height pxl)
  61.     SetupPaths
  62.     MenuEnable
  63.     UpdateTool
  64. END PROC
  65.  
  66.  
  67. PROC MainFormLocate
  68.     LOCAL iparams
  69.  
  70.     iparams = FormQ(_Size; fdMain)
  71.     theform.left = iparams[1]
  72.     theform.top = iparams[2]
  73.     theform.width = iparams[3]
  74.     theform.height = iparams[4]
  75.     RecalcRawFromPixels
  76.     MainClientLocate
  77. END PROC
  78.  
  79.  
  80. PROC MainClientLocate
  81.     LOCAL fdTemp, iparams
  82.  
  83.     fdTemp = FormQ(_Selected)
  84.     FormNew(FormQUnique; "", theform.style)
  85.     FormControl(_Size; theform.left pxl, theform.top pxl, theform.width pxl, theform.height pxl)
  86.     FormSetObject(10, _Frame, "", 0 pct, 0 pct, 100 pct, 100 pct)
  87.     iparams = FormQObject(10)
  88.     theform.cwidth = iparams[5]
  89.     theform.cheight = iparams[6]
  90.     FormControl(_Close)
  91.     IF fdTemp THEN
  92.         FormSelect(fdTemp)
  93.     END IF
  94. END PROC
  95.  
  96.  
  97. FUNC MainFormResize(left, top, width, height)
  98.     LOCAL sel, iparams
  99.  
  100.     FormNew(FormQUnique)
  101.     FormControl(_Size; _Center, _Center, 100 pct, 100 pct)
  102.     FormSetObject(10, _Frame, "Size and position the form." + Chr$(13) + Chr$(10) + "Press ENTER when finished.", left, top, width, height)
  103.     LOOP
  104.         SELECT CASE FormWait
  105.             CASE     2    'Cancel
  106.                 FormControl(_Close)
  107.                 RETURN 0
  108.             CASE 1    'ENTER
  109.                 EXIT LOOP
  110.         END SELECT
  111.     END LOOP
  112.     iparams = FormQObject(10)
  113.     theform.left = iparams[3]
  114.     theform.top = iparams[4]
  115.     theform.width = iparams[5]
  116.     theform.height = iparams[6]
  117.     RecalcRawFromPixels
  118.     FormControl(_Close)
  119.     RETURN 1
  120. END FUNC
  121.  
  122.  
  123. FUNC MainFormModify(modType, ..)
  124.     ' modType signals which code segments in MainFormModify execute. Values are:
  125.     '    0 - Resize only.
  126.     '    1 - Modify Form only.
  127.     '    2 - Resize and Modify Form.
  128.     ' optional parameters are current size of form in pixels
  129.     '
  130.     ' Returns 1 for OK and 0 for Cancel
  131.  
  132.     LOCAL rv
  133.  
  134.     IF (modType = 0) OR (modType = 2) THEN
  135.         IF QNOptParams THEN    'Modify current form
  136.             rv= MainFormResize(QOptParam(1), QOptParam(2), QOptParam(3), QOptParam(4))
  137.         ELSE                'New form
  138.             rv= MainFormResize(_Center, _Center, 90 pct, 90 pct)
  139.         END IF
  140.         IF rv = 0 THEN
  141.             RETURN 0
  142.         END IF
  143.         IF (modType = 0) THEN
  144.             MainFormCreate
  145.         END IF
  146.     ELSE
  147.         theform.left = QOptParam(1)
  148.         theform.top = QOptParam(2)
  149.         theform.width = QOptParam(3)
  150.         theform.height = QOptParam(4)
  151.         RecalcRawFromPixels
  152.     END IF
  153.     IF (modType >= 1) THEN
  154.         RETURN FormCharModal
  155.     END IF
  156.     RETURN 1
  157. END FUNC
  158.