home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / homonlib.zip / BOXCALC.BAS < prev    next >
BASIC Source File  |  1995-04-13  |  1KB  |  41 lines

  1. DEFINT A-Z
  2.  
  3. DECLARE SUB BoxCalc (t, l, b, r, wide, tall)
  4.  
  5. SUB BoxCalc (t, l, b, r, tall, wide)
  6. '****************************************************************************
  7. 'This function is used by other functions that draw pop-up boxes to calculate
  8. ' the box coordinates.
  9. '
  10. 'The box coordinates passed as t, l, b and r will be directly modified by the
  11. ' sub to contain the desired values.
  12. '
  13. 'See EditBox(), PickBox(), ListBox() and Progress() for examples of use.
  14. '
  15. '****************************************************************************
  16.  
  17. IF t = 0 THEN                      'If the top & left coordinates are passed
  18.      t = 13 - ((tall + 2) \ 2)     'as zero, assume they want the box
  19. END IF                             'centered on the screen.
  20. b = t + tall + 1
  21.  
  22. IF l = 0 THEN
  23.      l = 41 - ((wide + 2) \ 2)
  24. END IF
  25. r = l + wide + 1
  26.  
  27. IF b > 23 THEN                     'Try to avoid an error if possible,
  28.      x = b - 23                    'remembering to leave room for the shadow.
  29.      b = b - x
  30.      t = t - x
  31. END IF
  32.  
  33. IF r > 79 THEN
  34.      x = r - 79
  35.      r = r - x
  36.      l = l - x
  37. END IF
  38.  
  39. END SUB
  40.  
  41.