home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / TVGRAPH.ZIP / TVGRAFIC.DOC < prev    next >
Text File  |  1994-01-04  |  82KB  |  1,831 lines

  1.  
  2.  
  3.  
  4.                             Documenting TVGraphic
  5.  
  6.                             Ver 1.5, January 4, 1994
  7.  
  8.         TVGraphic  is a port of Borland's text based Turbo Vision to  DOS
  9.         graphics mode with extensions, enhancements and a pleasing graph-
  10.         ic  look.  It runs using the Borland EGA/VGA graphics  driver  in
  11.         color or black and white. It requires Turbo Vision TPU's plus the
  12.         Graph  unit  to compile programs. Core  functionality  is  nearly
  13.         identical to Turbo Vision but the BGI coordinate system is  used.
  14.         Minor  source changes are required to port existing  TV  applica-
  15.         tions  that  use standard views. Version 1.5 is shareware  -  see
  16.         license and registration info on pages five and six.
  17.  
  18.         TVGraphic  consists  of TPU's that  replace  the  correspondingly
  19.         named  TPU's of Turbo Vision, a TPU supplementing the  BGI  Graph
  20.         unit,  a  Mouse Cursor TPU, two Bitmap TPU's and  a  Window  TPU.
  21.         TPU's for both Turbo Pascal 6 and 7 are available. Most units are
  22.         overlayable.  TVGraphic  is currently based on Turbo  Vision  1.0
  23.         with bug fixes and many features from Turbo Vision 2.0. It is  in
  24.         a developmental phase. Comments are actively sought. It is  being
  25.         incrementally upgraded to Turbo Vision 2.0 level.
  26.  
  27.         Bitmaps and an intrinsic blinking text cursor plus the ability to
  28.         work  with a visual design tool for Dialogs are new in  ver  1.5.
  29.         See files BITMAP.DOC and TOOLS.DOC. Future directions may include
  30.         Protected  mode  version for BP 7.0, VESA  800x600  support,  C++
  31.         version, macro recorder/playback.
  32.  
  33.         Major Extensions beyond Turbo Vision include
  34.  
  35.           1. intrinsic support for larger than screen interiors  (drawing
  36.         surfaces)  in  all TGroup descendants (such as a  window).  These
  37.         interiors  can have TView/TGroup/TWindow descendants inserted  in
  38.         them.  Nesting of new TSubWindow view is allowed. Non-modal  Dia-
  39.         logs can be inserted into a window.
  40.  
  41.           2.  automatic sizing and handling of the graphic  viewport  and
  42.         the  Clip variable during partial screen redraws. Functions  pro-
  43.         vided both to return coords needed to set the viewport as well as
  44.         to return viewport relative screen coords needed for BGI  graphic
  45.         calls.
  46.  
  47.           3. Fonts
  48.         !FAST!  8x8  and 14x8 bit mapped text fonts that  clip  at  pixel
  49.         boundaries. also added TView field to store two fonts.
  50.  
  51.           4. Color
  52.         functions provided to parse colors from palette into form  needed
  53.         for  BGI graphic calls. Function provided to alter a single  pal-
  54.         ette color. TView field added to store two color pairs to  elimi-
  55.         nate  need  for  palette if desired. New colors  in  the  primary
  56.         Application color palette.
  57.  
  58.  
  59.  
  60.  
  61.                                         1
  62.  
  63.  
  64.  
  65.           5. Mouse Cursor grid
  66.         graphic  mouse cursor can be optionally locked (snapped) to  user
  67.         specified grid to match drawing grid or text size.
  68.  
  69.           6. Safer disk loads
  70.         intrinsic  support  in TGroup.Load and TCollection.Load  for  low
  71.         memory checking as each subview is loaded.
  72.  
  73.           7. Hooks for programmers
  74.         TView  has  an added general purpose virtual method  and  fields.
  75.         These allow TVGraphic users to extend the library functionality a
  76.         bit  without  re-deriving all the classes. Several  Turbo  Vision
  77.         methods in TView and descendants have been made virtual to  allow
  78.         more programing flexibility.
  79.  
  80.           8. TimerTick event class added.
  81.  
  82.           9.  Bitmaps  - bitmapped buttons, toolbar and  a  bitmap  view.
  83.         Works  with type .BMP bitmap files which may be loaded from  disk
  84.         or linked into your unit/program.
  85.  
  86.         Limitations of TVGraphic:
  87.           1. only runs on hardware supporting EGA or standard 16 color
  88.              VGA mode. (Will run on super VGA in standard VGA mode. Has
  89.                   palette for black and white monitors.)
  90.           2. bit mapped fonts print only horizontally in single size.
  91.  
  92.         Significant Portions of Turbo Vision not emulated in this version
  93.           1. History unit
  94.           2. Editors unit  -  development in process
  95.           3. TV2.0 MultiCheckBox
  96.           4. TV2.0 Validators
  97.           5. TV2.0 Extended Dialog Palette
  98.           6. TV2.0 Outline unit
  99.           TextView unit:a file of mods to the TV source code is supplied.
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.                                         2
  123.  
  124.  
  125.  
  126.  
  127.         CONTENTS
  128.  
  129.                                                                    page
  130.           0. Contact Information, License and Support Policy........4
  131.           1. Compatibility with Turbo Vision Objects................7
  132.              A. Stream Registration numbers
  133.           2. General Discussion of TVGraphic........................7
  134.              1. Coordinate system...................................7
  135.              2. TGroup Interiors {larger than screen}...............8
  136.              3. Coordinate Transformation...........................9
  137.              4. Drawing in TVGraphic...............................10
  138.                   General
  139.                   Color
  140.                   ViewPort
  141.                   Mouse Cursor and drawing
  142.                   Outline of a .Draw routine
  143.                   MyGraph3 and Graph -
  144.                   referencing, conflicts with TV
  145.                   Text, fonts
  146.                   A Limitation of TVGraphic's redraw Mechanism
  147.              5. Mouse Cursor.......................................16
  148.                   1. Grids and Sizing Views to work with them
  149.              6. Sizing the DeskTop,Menu,StatusLine.................18
  150.           3. Environment and Object Behavior vs Turbo Vision.......18
  151.           4. Converting from Turbo Vision..........................21
  152.           5. Customizing TVGraphic's Appearance....................22
  153.           6. Hooks for TVGraphic users.............................24
  154.           7. Intrinsic LowMemory checking during
  155.                        TGroup, TCollection.Load....................24
  156.           8. GWindows unit.........................................26
  157.           9. TimerTick events......................................27
  158.          10. Blinking text cursor..................................28
  159.          11. Button choices........................................28
  160.          12. Compiling with TVGraphic..............................29
  161.                List of Units, Paths, Caution on USES statements,Errors
  162.  
  163.  
  164.           Bitmaps - see file BITMAP.DOC
  165.           Design tool info - see file TOOLS.DOC
  166.           Tutorial on fundamentals - see file BEGINNER.DOC
  167.           See file README.DOC for latest info
  168.  
  169.           The DEMO program is an important part of the documentation.
  170.  
  171.  
  172.         Object by Object REFERENCE Section - see file REFER.DOC
  173.         -------------------------------------------------------
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.                                         3
  184.  
  185.  
  186.  
  187.  
  188.         CONTACT INFO and SUPPORT POLICY
  189.           Author
  190.              Richard P Andresen
  191.              RR2 Box 900
  192.              Hinesburg, Vermont 05461  U.S.A.
  193.              CompuServe User# 71222,1200
  194.               (via Internet:  71222.1200@compuserve.com)
  195.  
  196.           Support
  197.         Version  1.5  is a second release and should be  considered  very
  198.         usable  but in a developmental phase. Feedback, good and bad,  is
  199.         appreciated.  Please send feedback, bugs and questions by  Compu-
  200.         Serve  E-mail  or  postal mail. You can Email  from  Internet  to
  201.         CompuServe.  Users  requiring ongoing support will  be  asked  to
  202.         register.
  203.  
  204.         Since TVGraphic is based on Turbo Vision, Turbo Vision documenta-
  205.         tion is an integral part of working with TVGraphic. In  addition,
  206.         any problem/question that also appears in Turbo Vision should  be
  207.         addressed  to  Borland  support on  Borland's  CompuServe  Pascal
  208.         forum.  Note  that Turbo Vision 2.0 documentation  is  noticeably
  209.         better than version 1.0.
  210.  
  211.         An  environment  as complex as Turbo Vision or TVGraphic  can  be
  212.         extended  in  ways  the designers had in mind  without  too  much
  213.         trouble. But it is almost impossible to make changes that  affect
  214.         the entire unit or object hierarchy without the source code. As a
  215.         compiled  library, TVGraphic comes with built in hooks for  users
  216.         to  make  some level of modification possible. If  enough  people
  217.         express  an  interest  in certain features,  then  TVGraphic  can
  218.         incorporate them in a future release.
  219.  
  220.         If you want to try modifying the basic functionality of  TVGraph-
  221.         ic,  refer to Turbo Vision source code (either rev) to  gain  in-
  222.         sight  into functionality shared  with TVGraphic. Read the  Envi-
  223.         ronment  and  Object  Behavior  and  the  Reference  section  for
  224.         TVGraphic.  Leave me a message/questions on CompuServe AFTER  you
  225.         have studied things.
  226.  
  227.           Source code
  228.         Source  code  rights  rest jointly with the  author  and  Borland
  229.         International for TVGraphic modules whose names are analogous  to
  230.         Turbo  Vision names and solely with the author for other  modules
  231.         and  demo code/programs. If interested in licensing source  code,
  232.         contact the author for availability of source/Difference files.
  233.  
  234.         Turbo  Vision is a trademark of Borland International.  TVGraphic
  235.         is a trademark of Richard P. Andresen.
  236.  
  237.  
  238.                 TVGraphic and its documentation are
  239.                 Copyright (C) 1993,1994 Richard P Andresen
  240.  
  241.  
  242.  
  243.  
  244.                                         4
  245.  
  246.  
  247.  
  248.         License Agreement and Limited Warranty
  249.  
  250.             Copies  of  TVGraphic Ver 1.5 and its  documentation  may  be
  251.           freely distributed so long as no modifications are made and all
  252.           files  and this notice are included. Distribution with  commer-
  253.           cial programs is prohibited without specific permission.
  254.  
  255.             You  may  use  this software for your  personal  use  without
  256.           charge.  If you find it useful, please register to support  the
  257.           program.
  258.  
  259.           Distribution of programs created with TVGraphic:
  260.  
  261.                You or your organization may distribute programs that  you
  262.              create using the TVGraphic library only if you have extended
  263.              this license by registering for commercial use. This applies
  264.              whether  or  not a charge will be made for the  program.  It
  265.              also applies to distribution within an organization.
  266.  
  267.              Distributed programs must bear a valid copyright notice.
  268.  
  269.                You  are solely responsible to users of your programs  for
  270.              all support and warranty. You will indemnify and hold  harm-
  271.              less  Richard  P Andresen (the copyright  holder)  from  all
  272.              claims  and  liabilities arising from the use of  your  pro-
  273.              grams.
  274.  
  275.             You may not distribute any portion of TVGraphic as part of  a
  276.           library  of your own without specific permission  and  license,
  277.           nor may you decompile or disassemble the software.
  278.  
  279.             Under  this  license, you may not use TVGraphic  in  programs
  280.           involving human health or safety. (A sign of the times.)
  281.  
  282.         Limited Warranty
  283.  
  284.              The user acknowledges that this software is shareware where-
  285.           in users have an opportunity to use the software and read  this
  286.           license and warranty before registering. Users shall  determine
  287.           suitability  of this software for their purposes before  regis-
  288.           tering. Users acknowledge that portions of TVGraphic's behavior
  289.           are  intentionally  different from the  behavior  of  Borland's
  290.           Turbo Vision (TM).
  291.  
  292.              Licensor warrants to registered users that the software will
  293.           perform  substantially  in  accordance  with  the  accompanying
  294.           written  materials for a period of 90 days after  registration,
  295.           provided  that it is the current version at time  of  registra-
  296.           tion.
  297.  
  298.              The Licensor disclaims all other warranties, either  express
  299.           or  implied, including, but not limited to, implied  warranties
  300.           of  merchantability, fitness for a particular purpose and  non-
  301.           infringement. This limited warranty gives you specific  rights.
  302.           You may have others which vary state to state.
  303.  
  304.  
  305.                                         5
  306.  
  307.  
  308.  
  309.              Licensor's  entire liability and your sole remedy  shall  be
  310.           the licensor's choice of
  311.               A. return of the registration fee or
  312.               B. making publicly available a new version of the software.
  313.  
  314.              In no event will the Licensor be liable to you for  damages,
  315.           including any loss of profits or other incidental or consequen-
  316.           tial  damages arising out of your use or inability to  use  the
  317.           software.  This may not apply to you since some states  do  not
  318.           allow this exclusion.
  319.  
  320.           -------------------------------------------------------
  321.  
  322.         REGISTRATION - read license and limited warranty first.
  323.  
  324.           A personal use registration is $35.
  325.  
  326.           A single user commercial use registration for Version 1.5
  327.           is $95. ($65 if previously registered as a personal user.)
  328.  
  329.           Multi user - contact the author.
  330.  
  331.           Registration can be made via  (Check README.DOC for latest)
  332.              CompuServe's Shareware Registration forum - Go Computer
  333.              Mail        (US dollars - check, money order, cash)
  334.              Telephone/credit card      see Readme.Doc
  335.  
  336.         TVGraphic mail REGISTRATION FORM
  337.  
  338.           Name   ____________________________________________
  339.  
  340.           CompuServe or other user#  ________________________
  341.  
  342.           Address ___________________________________________
  343.  
  344.           Address ___________________________________________
  345.  
  346.           Postal code/Country   _____________________________
  347.  
  348.           I have version number __________________
  349.  
  350.                 ____    $35 Personal use
  351.                                (does not allow distribution of
  352.                                 programs created with TVGraphic)
  353.  
  354.                 ____    $95 single user Commercial use
  355.  
  356.                 ____    $65 Upgrade personal to Commercial use
  357.  
  358.  
  359.           Mail address
  360.              Richard P Andresen
  361.              RR2 Box 900
  362.              Hinesburg, Vermont 05461  U.S.A.
  363.  
  364.  
  365.  
  366.                                         6
  367.  
  368.  
  369.  
  370.         (**************************************************************)
  371.  
  372.         1. COMPATIBILITY WITH TURBO VISION OBJECTS (CLASSES)
  373.  
  374.         Due to additional data fields in TView, TVGraphic is not directly
  375.         compatible with TViews and descendants stored by Turbo Vision  in
  376.         streams  and resource files. It is compatible with  Turbo  Vision
  377.         data type objects (TRect,TCollection,etc.) and with Turbo  Vision
  378.         streams and resources.
  379.  
  380.           Stream Registration numbers
  381.         Stream registration numbers of 60,000 and above are reserved  for
  382.         TVGraphic. The registration numbers of TVGraphic's TView and  its
  383.         descendants equal the Turbo Vision number plus 60,000. The regis-
  384.         tration numbers of other objects match Turbo Vision.
  385.  
  386.         (**************************************************************)
  387.  
  388.         2. GENERAL DISCUSSION of TVGraphic
  389.  
  390.         In  the following sections the differences between TVGraphic  and
  391.         Turbo  Vision  will be discussed. There  is  extended  discussion
  392.         about  areas unique to TVGraphic. It is assumed that  the  reader
  393.         has some familiarity with Turbo Vision. In some cases, details of
  394.         Turbo Vision's operation will be explained to help users of  both
  395.         environments.  See also the separate BEGINNER.DOC file  for  some
  396.         tutorial material on TV/TVGraphic.
  397.  
  398.           Change Summary - OBJECTS
  399.         Only the visible objects of Turbo Vision (TView and  descendants)
  400.         plus TRect methods (see Coordinate System) have been changed. See
  401.         Turbo  Vision  documentation  for the others.  The  Mouse  Cursor
  402.         object and some others have been added.
  403.  
  404.           Change Summary - NON-OBJECTS
  405.         The  DOS  Critical error handler has been  changed.  Also  almost
  406.         everything having to do with drawing has changed - see Drawing.
  407.  
  408.         ------------------------
  409.  
  410.         2.1  The COORDINATE SYSTEM and TRect
  411.         TVGraphic uses the same coordinate system as the Graph unit while
  412.         Turbo  Vision  uses its own unique coordinate  system.  This  has
  413.         required  code changes in TRect's methods to match the  different
  414.         coordinate system.
  415.  
  416.         Using  the same coordinate system as the Graph unit is  necessary
  417.         for  sanity  when using the BGI drawing commands. It  also  means
  418.         that  it is easy to unintentionally specify adjacent screen  rec-
  419.         tangles  so they overlap by a pixel. This will happen if you  use
  420.         the  same screen coord to end one view and to start  an  adjacent
  421.         view  (which  is correct practice in Turbo  Vision).  Often  this
  422.         overlap doesn't cause a problem in TVGraphic. But if an edge of a
  423.         view seems to disappear or flicker on redraws, be sure the view's
  424.         outline  coordinates for that edge differ by one from its  neigh-
  425.  
  426.  
  427.                                         7
  428.  
  429.  
  430.  
  431.         bor.
  432.  
  433.         Remember  when  thinking of coord systems in the  Graphic  world,
  434.         that all graphic drawing procedures draw relative to the  current
  435.         origin of the graphic ViewPort.
  436.  
  437.         ------------------------
  438.  
  439.         2.2 Larger than Screen Drawing - TGROUP INTERIORS
  440.  
  441.         The  largest TGroup (or TWindow) you can define  meaningfully  is
  442.         still the size of the screen as in Turbo Vision. But imagine that
  443.         each  TGroup  has  an INTERIOR which is larger  than  its  screen
  444.         outline,  larger than the screen itself. Then the screen  outline
  445.         of  a TGroup is a viewing window looking onto a portion  of  this
  446.         large interior. By shifting this interior vertically and horizon-
  447.         tally,  we  can place any portion of it under the  TGroup  screen
  448.         outline.
  449.  
  450.         With TVGraphic, the subviews inserted in any TGroup (or  TWindow)
  451.         are  imagined to be in this Interior and can have Origins  and/or
  452.         Sizes  much larger than the screen. (Both Origins and Sizes  must
  453.         still  be  positive.)
  454.  
  455.         (Note: To find the maximum permitted value of a subview's  Origin
  456.         plus  Size  - For each axis, the subview's Origin plus  its  Size
  457.         plus  the  sum  of  the Origins all the way  up  the  view  chain
  458.         (TView.Owner.Origin,  TView.Owner.Owner.Origin,  etc.)   must  be
  459.         less  than  the maximum value of an integer  (32767)  to  prevent
  460.         arithmetic overflow.)
  461.  
  462.  
  463.           Shifting the Interior
  464.         TView  and  its descendants have an added field  for  a  variable
  465.         called  VOffset along with a method to set it. (VOffset  is  type
  466.         TPoint,  a  dual integer. TPoint and TRect are used so  often  in
  467.         Turbo Vision talk that you need to be familiar with them.)  VOff-
  468.         set is the number pair that determines the point in this extended
  469.         Interior that draws at the upper left corner of the TGroup  (i.e.
  470.         at the Group's Origin).
  471.  
  472.         VOffset defaults to 0,0 at initialization so the interior is  not
  473.         shifted.  When you use SetVOffset to change it and  then  redraw,
  474.         the  TGroup's interior will appear to move on the screen.  Making
  475.         VOffset.x  more  positive  will move the interior  to  the  left.
  476.         Making  VOffset.y more positive will move it up. It is  legal  to
  477.         have  negative values for VOffset though it's unlikely you  would
  478.         want them.
  479.  
  480.           Nesting Offset TGroups (TWindows)
  481.         Any  level of nesting is legal. (For TWindows, must use  TVGraph-
  482.         ic's TSubWindow or a descendant thereof for all subwindows.)
  483.  
  484.           Handling Mouse Events
  485.         Event passing is unchanged from Turbo Vision - i.e whatever  view
  486.  
  487.  
  488.                                         8
  489.  
  490.  
  491.  
  492.         the mouse cursor is over receives the mouse event. When you  call
  493.         MakeLocal  to  convert the mouse position to local  View  coordi-
  494.         nates, MakeLocal automatically takes into account all the  TGroup
  495.         VOffsets along the view chain. Same for MakeGlobal.
  496.  
  497.           Getting  Drawing  Coords
  498.         See the Coordinate Transformation and the Drawing sections.
  499.  
  500.         ------------------------
  501.  
  502.         2.3 COORDINATE Transformations
  503.  
  504.         TVGraphic  provides Coordinate transformation routines (as  TView
  505.         methods)  for  drawing that compute the  absolute  screen  coords
  506.         needed  by the Graph unit drawing procedure even if the  line  or
  507.         text  is in a subview of a nested set of windows, each with  non-
  508.         zero  VOffsets. Some of these transformations also take the  cur-
  509.         rent ViewPort setting into account.
  510.  
  511.  
  512.         MakeLocal
  513.           Used to convert from mouse coords (absolute screen coords) into
  514.         the  coord  system  of the Interior of  the  calling  view.  With
  515.         TVGraphic, this means the returned values are in the coord system
  516.         of the calling View's Interior. This is the same as Turbo  Vision
  517.         except you are not limited to the Size of the view.
  518.  
  519.         IMPORTANT NOTE:If you want to convert mouse coords into the coord
  520.         system  of  something like a Window's TFrame which  doesn't  move
  521.         with  the  Window's Interior, then TFrame must call  its  Owner's
  522.         MakeLocal,  i.e. Owner^.MakeLocal(). Otherwise your  TFrame  will
  523.         shift as the Interior shifts.This is different from Turbo Vision!
  524.  
  525.         MakeGlobal
  526.           Used  to convert the calling View's Interior coords into  abso-
  527.         lute  screen  coords (mouse coords). (Do NOT use to  convert  the
  528.         View's  Origin - Origins are already in the View's Owner's  coord
  529.         system.) Returned values can be used for repositioning the mouse.
  530.         Not  normally used for drawing because it doesn't take the  View-
  531.         Port  into account which TVGraphic changes during partial  screen
  532.         redraws.
  533.  
  534.         GetScreenCoords(var R : TRect)
  535.           Used to get the outline of the calling View in absolute  screen
  536.         coords.  Calling  GetScreenCoords(Glob) will  return  the  view's
  537.         Origin  in Glob.A, its lower right corner in Glob.B. Use the  re-
  538.         turned  numbers  to set the ViewPort if you want to clip  at  the
  539.         View's boundaries.
  540.  
  541.         GetVPRelCoords(var R : TRect)
  542.           Used  to get the outline of the calling View in ViewPort  rela-
  543.         tive coords. Calling GetVPRelCoords(Glob) will return the  View's
  544.         Viewport  relative Origin in Glob.A, its Viewport relative  lower
  545.         right corner in Glob.B. In your Draw routines, add this  relative
  546.         Origin to the Interior coords of any line, circle, text, etc. you
  547.  
  548.  
  549.                                         9
  550.  
  551.  
  552.  
  553.         are drawing and pass the sum to the BGI drawing function(s).
  554.           If you reset Viewport during a Draw, call GetVPRelCoords  again
  555.         to  get updated coords. (If the ViewPort is set to  full  screen,
  556.         GetVPRelCoords returns the same values as GetScreenCoords.)
  557.  
  558.         ------------------------
  559.  
  560.         2.4 DRAWING in TVGraphic
  561.  
  562.         Read previous sections first.
  563.  
  564.         Covers
  565.           General
  566.           Color
  567.           ViewPort
  568.           Mouse Cursor and drawing
  569.           Outline of a .Draw routine
  570.           MyGraph3 and Graph - referencing, conflicts with TV
  571.           Text, fonts
  572.           A Limitation of TVGraphic's redraw Mechanism
  573.  
  574.         Be  aware that the Turbo Vision SetState methods usually  include
  575.         indirect  calls to the Draw methods and to the automatic  partial
  576.         screen  redraws that TVGraphic handles. HandleEvent methods  also
  577.         call Draw as you might expect. Your Draw methods must be ready to
  578.         draw at any time, singly or as part of a group. Always use
  579.         GetVPRelCoords  to find your View's Origin coords and draw  rela-
  580.         tive to these coords unless you have a specific reason not to.
  581.         ----
  582.  
  583.         Drawing in TVGraphic and graphics in general.
  584.  
  585.         In  Turbo Vision, all drawing is done to memory buffers and  spe-
  586.         cial routines are used to load text into the buffer. Turbo Vision
  587.         Views often draw as many as three times to the buffer before  the
  588.         image is final and is transferred to the screen.
  589.  
  590.         Graphics is different. A buffer for a full, 16 color VGA  graphic
  591.         screen  is over 130K! Early VGA adaptors had only 256K of  memory
  592.         so there is only one screen page. Also GetImage/PutImage transfer
  593.         time on a 386 is surprising slow for even small views like  menus
  594.         - it is actually faster to redraw them. Therefore all drawing  in
  595.         TVGraphic is direct to screen. The drawback is that if you draw a
  596.         view  larger than a button multiple times to the screen you  will
  597.         likely see some flicker.
  598.  
  599.         Flicker occurs since the first operation of a graphic Draw method
  600.         is usually to call Bar or Bar3d to fill the area of the View with
  601.         a  background.  These  routines are very fast  even  for  a  full
  602.         screen.  Then the graphic shapes and text are redrawn. Lines  are
  603.         very  fast while text is the slowest to redraw. However, if  only
  604.         the color of the graphic objects needs to change and you know the
  605.         view  will never be partially obscured by another view (not  true
  606.         in  most  applications), you might try not  redrawing  the  back-
  607.         ground. Then you won't see flicker.
  608.  
  609.  
  610.                                         10
  611.  
  612.  
  613.  
  614.  
  615.         A  better solution is to split the drawing into two  sections  as
  616.         done for TCircles in the demo program. Let SetState and  HandleE-
  617.         vent  call your routine DrawIt which draws only  the  foreground.
  618.         Then  have Draw first draw the background and then  call  DrawIt.
  619.         TVGraphic will call Draw while you can selectively call DrawIt.
  620.  
  621.         When  fine tuning your application, pay careful attention to  how
  622.         many times and ways SetState changes the state of your view. Most
  623.         state changes call for a Draw somewhere in the tortuous path that
  624.         is Turbo Vision's inner working. (Note that SetState often  calls
  625.         itself again recursively.) You can override SetState to eliminate
  626.         some  of  these  indirect Draw calls {be sure to  let  the  state
  627.         change!} and override others right in your Draw routine by check-
  628.         ing  the  current state. In TVGraphic's standard views,  much  of
  629.         this has been done for you. Run the demo program to see how  well
  630.         the standard objects draw themselves.
  631.         ----
  632.  
  633.         Color Hints and Hooks
  634.           If you are creating objects with drawing behavior quite differ-
  635.         ent from text based applications, the color Palette system shared
  636.         by Turbo Vision and TVGraphic can seem very restrictive. To help,
  637.         each  TView  in TVGraphic has a spare field of  type  word  named
  638.         VColor. It can store a simple color or one or two color pairs  in
  639.         the form used by the palette.  I suggest ignoring the palette and
  640.         using  a mixture of global variables and VColor to start,  moving
  641.         towards palettes only as the application firms up.
  642.           The   Application  palette  contains  the  actual  colors   for
  643.         TV/TVGraphic and is a Pascal string. TProgram.GetPalette  returns
  644.         a pointer to the string which you can then use to load a  differ-
  645.         ent  color palette. (You will need to typecast this pointer to  a
  646.         PString  which is TV's string pointer type.) As  an  alternative,
  647.         once you have a pointer to the palette string, you can index into
  648.         it  to change individual color pairs.
  649.  
  650.              example:  const
  651.                          newcolorpair : byte = my color choice;
  652.                        var
  653.                            Pal : PString;
  654.                              n : byte; {offset of color into the palette}
  655.                          ....
  656.                          ....
  657.                          Pal := PString(TProgram.GetPalette);
  658.                          Pal^[n] := Chr(newcolorpair);
  659.  
  660.           The  default  colors in the Application palette  are  different
  661.         from Turbo Vision's choices.
  662.           See  the specific objects descriptions for their  mapping  into
  663.         the palette - some changes from TV.
  664.  
  665.           Accessing Colors
  666.         Several  new  functions are provided to sort out the  colors  re-
  667.         turned  by GetColor from the palette. (GetColor returns up  to  4
  668.         colors in a single call.)
  669.  
  670.  
  671.                                         11
  672.  
  673.  
  674.  
  675.                (var ColorPair,4Colors : word)
  676.           First make your usual call: ColorPair := GetColor(PaletteIndex)
  677.              then get individual colors using two new functions
  678.              ForeColor(ColorPair) => foreground color
  679.              BackColor(ColorPair)  => background color
  680.  
  681.           OR  (usual four color call)
  682.           4Colors := GetColor(HighlightPaletteIndex,PaletteIndex,)
  683.              ForeColor(Lo(4Colors)) => foreground color
  684.              BackColor(Lo(4Colors))  => background color
  685.              ForeColor(Hi(4Colors)) => highlight foreground color
  686.              BackColor(Hi(4Colors))  => highlight background color
  687.         ----
  688.  
  689.         ViewPort
  690.           Borland's Graph unit supports an invisible ViewPort that can be
  691.         sized  from a pixel to screen sized and positioned anywhere  over
  692.         the  screen.  All Graph unit drawing calls are  relative  to  the
  693.         upper  left corner of the ViewPort which is always 0,0. If  Clip-
  694.         ping is turned on, then drawing is clipped at the viewport bound-
  695.         aries.
  696.  
  697.           TVGraphic  expects you to set the Viewport to the size  of  the
  698.         DeskTop  in your TMyApp.Init. Suggest you turn clipping  on.  You
  699.         may also set the Viewport to full screen. If you do not write any
  700.         Draw  routines  for your application, this is the only  time  you
  701.         will set the ViewPort. TVGraphic handles it from then on.
  702.           Alternatively,  you  may change the Viewport  within  any  Draw
  703.         routine if you follow certain rules. You must be sure to save the
  704.         current  viewport  settings upon entering your Draw  routine  and
  705.         restore   them   before  exiting.  And  you  must   compute   the
  706.         TRect.Intersect(ion) of the current viewport with the  boundaries
  707.         of the viewport you wish to set - then use the computed Intersec-
  708.         tion to set the viewport within your .Draw. (The Intersection  is
  709.         only  the  area  covered  by both  rectangles).  If  you  forget,
  710.         TVGraphic  will  get confused when it attempts to redraw  just  a
  711.         portion of the screen using the viewport. Parts of the screen may
  712.         not  redraw or portions of overlapped views may seem to  draw  in
  713.         the wrong order.   See Demo program source code for examples.
  714.  
  715.         IMPORTANT  :  If you are using subviews that extend  outside  the
  716.         screen  in any way, and you reset the viewport, be sure  to  keep
  717.         Viewport clipping ON or you may trash memory.
  718.         ----
  719.  
  720.         Graphic mouse cursor and .Draw routines
  721.           You  must hide the mouse before drawing in a .Draw and  restore
  722.         it  after.  It is not done automatically. DO NOT Call  Turbo  Vi-
  723.         sion's HideMouse and ShowMouse! The cursor you see is not the one
  724.         controlled by these calls. Do not call the mouse driver  directly
  725.         ( the mouse driver's cursor should be kept turned off.) The  MCur
  726.         unit  provides some methods to control the driver. More  info  on
  727.         the mouse cursor in section 2.5.
  728.  
  729.           The mouse cursor object is named MCur.
  730.  
  731.  
  732.                                         12
  733.  
  734.  
  735.  
  736.             See unit MCur in Reference file.
  737.             Also see .Draw  program example.
  738.  
  739.         In a TView descendent Draw method, use MCur.Hide and MCur.Show.
  740.  
  741.         In a TGroup descendent, you do not need to do anything about  the
  742.         mouse  cursor if it does not have its own Draw routine. (Then  it
  743.         just  calls  TGroup.Draw.) However, if you write your  own  Group
  744.         Draw, then you should use MCur.LockHide and MCur.LockShow.  These
  745.         commands  both  hide/show  the mouse  and  increment/decrement  a
  746.         counter  that starts at 0. Every time you call MCur.LockHide  the
  747.         counter  is incremented. MCur.LockShow decrements it. As long  as
  748.         the counter is not zero, the cursor remains hidden and the  calls
  749.         to MCur.Hide and MCur.Show return without any action. Thus if you
  750.         are  drawing a number of subviews, each of which should have  its
  751.         pair of Hide and Show, the cursor won't keep flashing on and off.
  752.         Note  that if you have more LockHides than LockShows, the  cursor
  753.         will remain locked invisible throughout your program.
  754.         ----
  755.  
  756.         Outline of a .Draw routine  {call order is important}
  757.              {see Demo.PAS for examples}
  758.              {local variable Glob is type TRect}
  759.           Hide the mouse    MCur.Hide
  760.           if setting Viewport, save current settings
  761.           Compute the Intersection of the current and desired Viewports
  762.           Set the Viewport, if necessary, using the Intersected area
  763.           Get the Origin of this view in viewport relative coordinates by
  764.             calling GetVPRelCoords(Glob).
  765.           Set the drawing color. Set text font if drawing text.
  766.           Make your drawing calls relative to the view's Origin:
  767.             Line(Glob.A.x+LineStart.x, Glob.A.y+LineStart.y
  768.                  Glob.A.x+LineEnd.x  , Glob.A.y+LineEnd.y);
  769.           Reset Viewport to previous settings if changed.
  770.           UnHide the mouse    MCur.Show
  771.         ----
  772.  
  773.         Referencing the Graph/MyGraph3 Units
  774.  
  775.         ! IMPORTANT !
  776.           Do  not reference the Borland's Graph unit directly  from  your
  777.         program.  In other words, use MyGraph3 in the Uses statement,  not
  778.         Graph.
  779.  
  780.         Make graphic calls to the MyGraph3 unit with the same names as  if
  781.         calling to the Graph unit. User Heap management is not supported.
  782.  
  783.         Some  calls to Graph routines are intercepted in MyGraph3  -  Set-
  784.         TextStyle  and Bar for example, and possibly more in the  future.
  785.         If printing capability is added, it will also function by  inter-
  786.         cepting  calls here. Note that the MyGraph3 contains  the  drivers
  787.         for Font8x8 and Font14x8.
  788.  
  789.  
  790.         Conflicts between Turbo Vision Names and Graph/MyGraph3 Unit Names
  791.  
  792.  
  793.                                         13
  794.  
  795.  
  796.  
  797.  
  798.         ! CAUTION - guaranteed to byte you !
  799.  
  800.         Gotcha #33 : Both TView and the BGI have a MoveTo command!
  801.         If you say MoveTo(10,140) in your Draw routine, the View will try
  802.         to move!!!
  803.                 Must say :    MyGraph3.MoveTo(10,140).
  804.         When  your Draw routines absolutely refuses to write in the  cor-
  805.         rect spot on the screen late at night, this is what is happening.
  806.  
  807.         Gotcha #34 : Both TView and the BGI have a GetColor command!
  808.         GetColor in a Draw routine calls TView.GetColor. You can call the
  809.         graph unit's MyGraph3.GetColor but I suggest avoiding it in  your
  810.         program design if you want to get to bed on time.
  811.         ----
  812.  
  813.         TEXT in TVGraphic
  814.  
  815.           You can use any of the four Borland fonts (ten in version  7.0)
  816.         or after market fonts but read on...
  817.           The  standard  fonts supplied with the BGI don't give  one  any
  818.         good  alternatives  for text in many  graphic  applications.  The
  819.         Default  font is a bitmapped 8x8 font which cannot be clipped  in
  820.         the  middle  of  a character and won't draw at all  if  a  string
  821.         starts off the left side of the screen. All the nine stroke fonts
  822.         with  the exception of Smallfont are illegible when drawn at  the
  823.         size  of  a  standard textmode character  (around  8x14  pixels).
  824.         Smallfont  will work in this size though it is  not  particularly
  825.         attractive.
  826.  
  827.         The Good News
  828.           TVGraphic  provides two fast bitmapped fonts that clip  at  the
  829.         pixel level. Font8x8 is 8x8 pixels and Font8x14 is 8x14 which  is
  830.         the  size  of EGA text. Font8x8 is useful if you want  a  drawing
  831.         grid  of 10x10 pixels - you can snap the mouse cursor to  a  grid
  832.         like this, for example, and position the text so that an  on-grid
  833.         line  can be drawn above and below it. (A capital M is  only  7x7
  834.         pixels  in  an  8x8 bitmapped font. The other bit  is  for  space
  835.         between  lines and chars.) These fonts draw Much faster than  BGI
  836.         Default font for long strings. Bitmapped text draws fast on  slow
  837.         CPU machines.
  838.  
  839.         The Bad News
  840.           These  two bitmapped fonts can only draw horizontally, size  is
  841.         not  changeable, and the BGI text justification commands have  no
  842.         effect on them. Starting with version 1.5, bitmap text speed  has
  843.         been improved threefold so there is no longer any bad news  about
  844.         that.
  845.  
  846.         Other news
  847.           Font8x14  is the default font for TVGraphic menus  and  Dialogs
  848.         (you can change these default fonts - see Reference section).
  849.           All  supplied Views (except the scrollbar) use the font  stored
  850.         in  added  field  TView.VFont. Many of these  views  compute  the
  851.         length  of text they display for various internal purposes.  They
  852.  
  853.  
  854.                                         14
  855.  
  856.  
  857.  
  858.         expect  text to be 8 pixels wide which limits you  to  SmallFont,
  859.         Font8x8, Font8x14 or any 8 pixel wide font you have. (See  TStat-
  860.         icText in Reference section for a few exceptions to this.)
  861.           In your own Views, you can use any font, store your font selec-
  862.         tion(s) in VFont and set it with SetTextStyle. Be aware that most
  863.         vector  fonts  (except SmallFont) do not have  uniform  character
  864.         widths.  This means a string of characters varies in  length  de-
  865.         pending on which characters it contains.
  866.  
  867.         Text Support Variables and Routines
  868.           In  Turbo  Vision, all drawing is done to buffers  and  special
  869.         routines are used to load text into the buffer.
  870.           In  TVGraphic, the standard Graph unit procedures  OutText,Out-
  871.         TextXY,  plus  two special routines,  WriteCStr  and  WriteCStrXY
  872.         handle text.
  873.           To  write Turbo Vision's special highlighted strings  with  the
  874.         embedded tilde characters '~' , position the graphics cursor with
  875.         MyGraph3.MoveTo(x,y),  then call WriteCStr. Or  use  WriteCStrXY.
  876.         Function CStrLen will return the length of the string without the
  877.         tilde's.
  878.           WriteCStr  takes the text string plus the normal and  highlight
  879.         text  colors. Otherwise it behaves like OutText, which it  calls,
  880.         and  may  be used to write any string to the  screen.  WriteCStr,
  881.         WriteCStrXY and Turbo Vision's CStrLen are global, not part of an
  882.         object. See Reference Section.
  883.  
  884.           A dynamic vertical justification value of BYOffset is  provided
  885.         for use with Font8x8, Font8x14, SmallFont. See Reference section.
  886.  
  887.         Adding Your Own Fonts
  888.           Follow the usual BGI procedures. Font8x8 is font number 14  and
  889.         Font8x14 is number 15. Pascal version 7.0 has assigned font names
  890.         for  numbers 0 through 10 despite what the printed  documentation
  891.         says.  You  can still add your own fonts and I am  assuming  that
  892.         they  will be assigned at 11,12, and 13. If the BGI assigns  your
  893.         font  a  number of 14 or higher, TVGraphic  will  substitute  its
  894.         fonts.
  895.  
  896.         Storing fonts numbers
  897.           Use TView.Vfont which is a byte. Since the maximum font  number
  898.         in TVGraphic is 15, you can pack two fonts into VFont and use the
  899.         TVGraphic color methods ForeColor and BackColor to separate them.
  900.  
  901.         Failed Calls to SetTextStyle
  902.           TVGraphic will substitute Font8x8 if your call to  SetTextStyle
  903.         fails to select the designated font. See SetTextStyle in  Borland
  904.         documentation.
  905.         ----
  906.  
  907.         ! Limitation of TVGraphic Automatic Redrawing mechanism !
  908.  
  909.             TVGraphic's partial redraw scheme isn't aware of open
  910.             submenu(s) extending over the DeskTop. This is because
  911.             they are inserted in the Application, not the DeskTop.
  912.             If submenus are open and you create an overlapping modal
  913.  
  914.  
  915.                                         15
  916.  
  917.  
  918.  
  919.             view, such as a Help dialog, you must manually call the
  920.             submenu chain to redraw themselves when the dialog closes
  921.             as shown here.
  922.  
  923.           example
  924.               Control := ExecDialog(HelpDialog);
  925.                  { or
  926.                    Control := DeskTop^.ExecView(HelpDialog);
  927.                    Dispose(HelpDialog,Done);}
  928.  
  929.                       {redraw the submenu chain}
  930.               P := MenuBar^.Target;     {first submenu in the chain}
  931.               while P <> nil do begin   {redraw all open submenus}
  932.                 P^.DrawView;
  933.                 P := P^.Target;
  934.               end;
  935.  
  936.         ------------------------
  937.  
  938.         2.5 MOUSE CURSOR
  939.  
  940.         Do  not call the mouse driver directly. Do not call Turbo  Vision
  941.         ShowMouse,  HideMouse.  Make calls using the MCur  (mouse  cursor
  942.         object) methods.
  943.  
  944.         See  Section  ENVIRONMENT and OBJECT BEHAVIOR, Mouse Button  Phi-
  945.         losophy for how to alter behavior of right mouse button to  match
  946.         Turbo Vision.
  947.  
  948.          The  demo  program  shows  a  way  of  suppressing   consecutive
  949.         "Event.Double" 's. This can be handy in programs which try to get
  950.         a lot of different actions from mouse button activity.  Otherwise
  951.         it shouldn't be necessary.
  952.  
  953.  
  954.         GRIDS AND SIZING VIEWS TO WORK WITH THEM
  955.  
  956.         Mouse Cursor Grids
  957.  
  958.           A  mouse  cursor grid causes the cursor to jump from  point  to
  959.         point on the grid instead passing through every pixel.  TVGraphic
  960.         defaults to a 10x10 pixel grid on startup. To override this,  set
  961.         the grid in your application's .Init after the call to MCur.Init.
  962.         See below and demo program for code.
  963.  
  964.           Two types of mouse grids may be desired. One would be for views
  965.         that are text based such as Dialogs, Menus and Text Scrollers and
  966.         the  other  would be for graphic drawing to grid where  a  square
  967.         grid  of 5x5 or 10x10 pixels might be convenient. (A  10x10  grid
  968.         and  Font8x8  work  well together.) Of course all  grids  can  be
  969.         turned off.
  970.  
  971.         See Demo program source for actual code.
  972.         See MCur in Reference Section for all mouse cursor calls.
  973.  
  974.  
  975.  
  976.                                         16
  977.  
  978.  
  979.  
  980.         To turn off all mouse grids :
  981.  
  982.             MouseSnapToDialogGrid = false
  983.             MouseSnapToMenuGrid = false
  984.             MCur.SetGrid(1,1,0,0)
  985.                {sets the mouse grid to single pixel, no offset}
  986.  
  987.         Setting a Grid
  988.  
  989.         MCur is the mouse cursor object.
  990.         SetGrid is the method to set the mouse cursor grid.
  991.             SetGrid(XGridpitch,YGridpitch,XGridOffset,YGirdOffset)
  992.         The first two parameters set the grid pitch and the last two  set
  993.         the  offset of the grid points from the upper left corner of  the
  994.         screen.
  995.  
  996.         (In  addition to setting a grid, you might also want to  restrict
  997.         the  mouse movement on the screen for a portion of a program.  Do
  998.         not call the mouse driver directly. Use MCur methods. See  Refer-
  999.         ence Section.)
  1000.  
  1001.           Note that the mouse grid is referenced to the upper left corner
  1002.         of  the screen, not the DeskTop. Therefore you usually must  take
  1003.         the  height  of  the MenuBar into account since  your  views  are
  1004.         inserted in the DeskTop. Suggested heights of the MenuBar are  15
  1005.         or 20 pixels. (See DefaultMenuBarHeight in Reference Section.)
  1006.  
  1007.           If  you wanted a 10x10 mouse grid, you would probably make  the
  1008.         size  of your windows multiples of 10. Conversely if the  windows
  1009.         display  text and you use the bit mapped fonts, it is  convenient
  1010.         to  dimension the windows using the TVGraphic  constants  Charlen
  1011.         and Boxheight.
  1012.  
  1013.         Saving a Grid
  1014.           Call MCur.GetGrid(var AGrid : MGridRec) to get the current Grid
  1015.         settings.
  1016.  
  1017.         Automatic Grids
  1018.           A feature that makes life easier is that snapping the mouse  to
  1019.         the Dialog and Menu grid is automatic in TVGraphic if you  enable
  1020.         it.  These  snaps are based on a standard text box that  is  Box-
  1021.         height  tall by N*Charlen wide. (Font8x8,Font8x14  and  SmallFont
  1022.         can  work in this box.) Furthermore these snaps are  active  only
  1023.         when  a box submenu or Dialog box is executing and  they  restore
  1024.         the previous user specified grid when the menu or Dialog returns.
  1025.         They also correct for the height of the MenuBar.
  1026.  
  1027.           The  box subMenus are automatically sized using  this  standard
  1028.         text box. If you size your Dialogs using integer multiples of the
  1029.         Charlen and Boxheight constants as well as setting the Origin  of
  1030.         all  the views you insert into the Dialog with integer  multiples
  1031.         of these same constants, the automatic grid will work.
  1032.  
  1033.              (i.e. R.A.x := I*Charlen;   R.B.x := R.A.x + J*Charlen
  1034.                    R.A.y := M*Boxheight; R.B.y := R.A.y + N*Boxheight;
  1035.  
  1036.  
  1037.                                         17
  1038.  
  1039.  
  1040.  
  1041.                        where I,J,M,N : integer, R,Bounds : TRect
  1042.                    Bounds := R;
  1043.                    TView.Init(Bounds);  )
  1044.  
  1045.           One  additional  point  - when inserting the  Dialog  into  the
  1046.         DeskTop, again use integer multiples of the Charlen and Boxheight
  1047.         constants  for the Dialogs Origin. Or even easier, just  set  the
  1048.         ofCentered  flag in the Dialog.Option field (not VOptions  field)
  1049.         and  set  the  Origin to (0,0). Then  call  DeskTop^.ExecView  or
  1050.         ExecuteDialog.  TVGraphic will center your Dialog in the  DeskTop
  1051.         regardless  of the height of your MenuBar. If the  Dialog  cursor
  1052.         snap  is on, it will modify its centering slightly so the  Dialog
  1053.         is perfectly positioned on this mouse text grid.
  1054.  
  1055.  
  1056.         Using the Text Grid (Charlen x Boxheight) in your own views:
  1057.  
  1058.           First follow the above rules on view sizing. Then when you call
  1059.         OutTextXY or MyGraph3.MoveTo, add the TVGraphic variable  BYOffset
  1060.         to  your Y coordinate. It is adjusted by TVGraphic to  match  the
  1061.         text  grid and the currently selected font (bit mapped or  Small-
  1062.         font).
  1063.  
  1064.         ------------------------
  1065.  
  1066.         2.6 Sizing the DeskTop,Menu,StatusLine     see demo program
  1067.            In  TVGraphic  the  MenuBar height is sized  based  on  global
  1068.         variable MenuBarHeight (default value = 15). The Bounds.B.y value
  1069.         you  pass  when calling .Init is ignored. To change  the  height,
  1070.         change  the value of MenuBarHeight before calling  TProgram.Init.
  1071.         See demo program for example of changing it.
  1072.            In  TVGraphic's TProgram.Init, the DeskTop is sized  automati-
  1073.         cally  based on the height of the Menubar and the height  of  the
  1074.         StatusLine, if they exist. If you won't be using a top menubar or
  1075.         a StatusLine, you must still override TProgram.InitMenuBar and/or
  1076.         InitStatusLine to prevent a default version from being created.
  1077.            If  your  application  has a natural vertical grid  -  say  14
  1078.         pixels for lines of text or 10 pixels for a drawing program - you
  1079.         may  be able to choose the heights of menubar and  statusline  to
  1080.         give you an integral number of grid spacings in the Desktop.
  1081.  
  1082.         (**************************************************************)
  1083.  
  1084.         3. ENVIRONMENT and OBJECT BEHAVIOR
  1085.         In  general  the  default  behavior of objects  is  the  same  in
  1086.         TVGraphic  as in Turbo Vision. Some exceptions are  noted  below.
  1087.         TView has an added field VOptions which is used by some Views  to
  1088.         hold  flags  that modify their behavior. VOptions and  its  flags
  1089.         will evolve as TVGraphic evolves. See the Reference Section.
  1090.  
  1091.         evTimerTick
  1092.           There is a new class of events based on the DOS timer tick. See
  1093.         GDrivers in the Reference Section.
  1094.  
  1095.         Mouse Button Philosophy
  1096.  
  1097.  
  1098.                                         18
  1099.  
  1100.  
  1101.  
  1102.           As  a graphical environment where the mouse may be involved  in
  1103.         drawing  as well as selecting, TVGraphic has different rules  for
  1104.         mouse buttons than Turbo Vision. The left button selects, starts,
  1105.         moves, etc. while the right button cancels, quits without action.
  1106.         The return key maps to the left button and the escape key to  the
  1107.         right  button. Turbo Vision's mouse handler does not  distinguish
  1108.         between  left  and right button releases so often  TVGraphic  re-
  1109.         sponds  to  button presses (evMouseDown  events),  not  releases.
  1110.  
  1111.           BUT NOW you can change some of this starting with Version 1.5 .
  1112.  
  1113.         Unit GViews defines a global variable used by all standard views.
  1114.  
  1115.                AllowBothMButtons : boolean = False;
  1116.  
  1117.           By  setting AllowBothMButtons true, TVGraphic will  respond  to
  1118.         the  right mouse button as TV does. (Will not change response  to
  1119.         mouse down events.) This includes NOT exiting a modal dialog on a
  1120.         right button press.
  1121.  
  1122.         Note: With ver 1.5, TVGraphic returns left and right button codes
  1123.         in TEvent.Buttons for evMouseUp .
  1124.  
  1125.         Mouse Movement
  1126.           As is described elsewhere, a user adjustable mouse cursor  grid
  1127.         is  part  of the environment. The grid and its  offset  from  the
  1128.         upper  left corner of the screen is setable in pixel  increments.
  1129.         The  grid may be set to character size in the Menus  and  Dialogs
  1130.         but  be  different  for the screen in general. See  MCur  in  the
  1131.         Reference section. Note: The mouse cursor you see in TVGraphic is
  1132.         not the mouse driver's cursor.
  1133.  
  1134.         Menus
  1135.           The  behavior of the mouse in the menus  differs  significantly
  1136.         from Turbo Vision. Right mouse button cancels a menu, left button
  1137.         immediately selects the entry. Unless you are used to the  MacIn-
  1138.         tosh computer, you probably won't notice. Also TV bug where  menu
  1139.         returns if mouse clicks on menu background is eliminated.
  1140.           Right button for popup submenu is not supported.
  1141.  
  1142.         TBackground
  1143.           Gets  its  pattern  from the palette.  You  have  four  pattern
  1144.         choices.
  1145.  
  1146.         TButton
  1147.           The  method  of keeping track of which button  is  the  Default
  1148.         button is completely different from Turbo Vision. This should not
  1149.         be  noticeable unless you try to make further modifications.  See
  1150.         Reference  section  on  how to change the  default  button  after
  1151.         initializing. Bitmapped buttons are covered in file Bitmap.Doc.
  1152.  
  1153.         TCollection.Load
  1154.           See section heading in this file on TGroup/TCollection Loads.
  1155.  
  1156.  
  1157.  
  1158.  
  1159.                                         19
  1160.  
  1161.  
  1162.  
  1163.         TDialog
  1164.           Unlike TV, a dialog can be Inserted into a window.
  1165.             i.e.     MyWin.Insert(MyDialog).
  1166.  
  1167.         TFileDialog/TChDirDialog
  1168.           The instant erase feature of the inputline has been disabled.
  1169.         It can be enabled by clearing the KillInstantErase bit in the
  1170.         PFileDialog^.FileName^.VOptions field.
  1171.  
  1172.         TFrame
  1173.           The TFrame does not draw frames for subviews (depending on  the
  1174.         ofFramed bit) as in TV. Instead the subviews are responsible  for
  1175.         drawing  their  own frame depending on ofFramed.  See  ofXXXX  in
  1176.         reference section.
  1177.           If  the proper VOptions flag is set, a TFrame will draw a  com-
  1178.         plete  background for its window. By default, it does not  redraw
  1179.         the interior. This can reduce flicker during redraws.
  1180.           Other VOption flags are set by TWindow.StandardScrollBar to let
  1181.         TFrame  know if right and bottom edge scrollbars are present.  If
  1182.         so, it fills in background areas under and next to them.
  1183.  
  1184.         TGroup.Load
  1185.           Tests  after  each subview for LowMemory. Exits if  true.  User
  1186.         should  verify top object being loaded with ValidView  to  insure
  1187.         complete Group and subgroups were loaded.
  1188.           See section heading in this file on TGroup/TCollection Loads.
  1189.  
  1190.         TInputLine, TgInputLine
  1191.           A VOptions flag is available to turn off the maddening  instant
  1192.         erasure of an existing entry when you touch a key. Also a flag to
  1193.         cause the input line to be right justified.See Reference Section.
  1194.  
  1195.         TScrollBar
  1196.           In  TV, a scrollbar depends on a TScroller view to tell  it  to
  1197.         display   or  hide  as  the  TScroller  (and  its  window)   goes
  1198.         Active/inActive (sfActive).
  1199.           In  TVGraphic, scrollbars do not need a scroller object -  they
  1200.         respond directly to the state of the window they are inserted  in
  1201.         just  like a TFrame.  TScrollBar.SetState handles sfActive  state
  1202.         changes itself. The TScroller does not control the scrollbar(s).
  1203.           Also,  a  scrollbar draws its background when  its  window   is
  1204.         inActive rather than disappearing.
  1205.  
  1206.         TScroller
  1207.           TScroller  scrolls  by  pixel increments.  See  demo  program's
  1208.         TMyScroller for full example of a standard text based scroller.
  1209.  
  1210.         TStaticText, TgStaticText
  1211.           Does NOT draw its own background unless you set Opts := txDraw-
  1212.         Background  in  the constructor call or VOptions :=  VOptions  or
  1213.         txDrawBackground after constructing.
  1214.  
  1215.         TStatusLine, TgStatusLine
  1216.           Events  broadcast  by the StatusLine have the  InfoPtr  set  to
  1217.         Ptr(0000,0001) rather than nil as in Turbo Vision.
  1218.  
  1219.  
  1220.                                         20
  1221.  
  1222.  
  1223.  
  1224.  
  1225.         TView and descendants - Drawing
  1226.           Almost every method that has to do directly or indirectly  with
  1227.         drawing  has been modified or replaced  including  TView.Exposed.
  1228.         The  Turbo  Vision  source code won't help much  here.  The  Clip
  1229.         variable  is in use. A routine is provided so you can  access  it
  1230.         although TView.Exposed is checking it already.
  1231.  
  1232.         TWindow
  1233.           The  interior  of a window does not draw while  the  window  is
  1234.         being  dragged. Mouse clicking on the window's number will  cause
  1235.         the  next  window to be selected. Windows with no  window  number
  1236.         have a different appearance than regular windows.
  1237.           A function is provided to return the bounds inside the window's
  1238.         frame that should be covered by views.
  1239.  
  1240.         (**************************************************************)
  1241.  
  1242.         4. CONVERTING FROM TURBO VISION
  1243.  
  1244.         Converting View Sizes from Turbo Vision
  1245.  
  1246.           If  you use the bitmapped fonts or Smallfont, it is a  snap  to
  1247.         convert  from  Turbo  Vision  coordinates  to  TVGraphic  coords.
  1248.         TVGraphic  defines  the constants Charlen and  Boxheight.  Simply
  1249.         multiply  all X coords by Charlen and all Y coords by  Boxheight.
  1250.         Where  views touch, take the lower right corner  coords  obtained
  1251.         from this multiplication and subtract one from both x and y. This
  1252.         prevents views from overlapping.
  1253.  
  1254.           Buttons Sizes
  1255.           The above conversion makes rather fat looking Buttons since the
  1256.         button  shadow is very thin in TVGraphic. The suggested  alterna-
  1257.         tive is to use the TVGraphic constant
  1258.                    DefaultButHt : integer = 20;
  1259.           to set the vertical button size
  1260.                    Bounds.A.y := ....
  1261.                    Bounds.B.y := Bound.A.y + DefaultButHt;
  1262.                    AButton.Init(Bounds);
  1263.           (You may also set DefaultButHt to another value.)
  1264.  
  1265.  
  1266.         Converting HandleEvent and Draw methods
  1267.  
  1268.           If  you  have  written your own HandleEvent  methods  in  Turbo
  1269.         Vision read on...
  1270.           If  they  use  view or mouse coords (from  mouse  events),  the
  1271.         coords  will  now be in pixel units. If you want to  retain  text
  1272.         based  thinking, divide the X coord by Charlen and divide  the  Y
  1273.         coord by Boxheight (this is the inverse of Converting View  Sizes
  1274.         above).  If you are dividing the view's Size to get back to  text
  1275.         coords, then remember that, in graphic mode, views run from 0  to
  1276.         Size pixels so do as follows:
  1277.                 NumXchar's := (Size.x+1) div Charlen
  1278.                 NumLines   := (Size.y+1) div Boxheight
  1279.  
  1280.  
  1281.                                         21
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.           If  you want to pan in TVGraphic using the larger  than  screen
  1288.         Interior  of a TVGraphic Group
  1289.           and  you are converting a TFrame, Scrollbar or other view  that
  1290.         is  inserted in the panning Group BUT you want the view  to  stay
  1291.         fixed as the Interior scrolls/pans,
  1292.           then
  1293.         Whenever you need to call MakeLocal, MakeGlobal, GetScreenCoords,
  1294.         GetVPRelScreenCoords  for  this  fixed view,  actually  call  the
  1295.         routine of the view's owner, i.e. call Owner^.MakeLocal() instead
  1296.         of  MakeLocal. If you fail to do this, your view will  pan  along
  1297.         will the rest of the inserted views.
  1298.  
  1299.         More on Draw Methods
  1300.  
  1301.           Because  of the change to Graphics mode, Draw methods  are  not
  1302.         really convertible. You must rewrite them following the  approach
  1303.         described  in  section Drawing in TVGraphic and examples  in  the
  1304.         demo source code.
  1305.  
  1306.  
  1307.         Converting Dialog Unit Init's
  1308.  
  1309.           TVGraphic  provides  an additional parameter in the  Init  con-
  1310.         structors for several views in the GDialogs unit. This  parameter
  1311.         comes last in the parameter list, after the parameters defined by
  1312.         Turbo  Vision.  It is used for setting options that  affect  view
  1313.         behavior and font selection.
  1314.  
  1315.           The  simplest approach to conversion is to set  this  parameter
  1316.         equal  to the constant DefaultOpts. This will match Turbo  Vision
  1317.         and cause a default font to be stored in the view's VFont.  After
  1318.         your program is running, you can examine the TVGraphic options in
  1319.         the Reference Section to see if you want to set any of them.
  1320.  
  1321.         (**************************************************************)
  1322.  
  1323.         5. Customizing TVGraphic's Appearance
  1324.  
  1325.         How to change TVGraphic's appearance
  1326.  
  1327.         TVGraphic  has  the usual Turbo Vision style  color  palette  but
  1328.         there  are many other things that can be changed. This is a  sum-
  1329.         mary  of  material on settings for changing  appearance.  If  you
  1330.         don't see what you want here, also check the Reference file under
  1331.         likely Unit name(s) and/or Object names for user changeable  set-
  1332.         tings. Be sure to look at the demo program for examples.
  1333.  
  1334.         GAPP
  1335.           procedure ImprovePaletteColors;
  1336.              improves look of dark gray and brown on VGA monitors,
  1337.              no effect in EGA
  1338.  
  1339.  
  1340.  
  1341.  
  1342.                                         22
  1343.  
  1344.  
  1345.  
  1346.         GBUT
  1347.         const
  1348.           {use with Opts field of TIconButton}
  1349.           tbDrawFrame
  1350.               draws a button shadow frame over the perimeter
  1351.               of the bitmap
  1352.           tbAutoSize
  1353.               the button sizes itself to match the bitmap
  1354.           tbDrawDisabled
  1355.               bitmap colors change when Command is disabled,
  1356.               see TIconButton.DrawState
  1357.           tbDrawThickFrame
  1358.  
  1359.         GDIALOG
  1360.           DefaultButHt : integer = 20;
  1361.               default button height in standard views
  1362.           TextButtonsMatchBitMapButtons : boolean = false;
  1363.               whether text based buttons should look like Turbo Vision
  1364.               or look similar to TVGraphic's bitmapped buttons
  1365.           DefaultDialogFont : byte = font8x14;
  1366.               affects TButton,TInputLine. Also all Text views unless
  1367.               overridden   in Init(..,..,.,Opts); parameter.
  1368.           MouseSnapToDialogGrid : boolean = true;
  1369.               causes mouse cursor to snap to a 8x14 pixel grid while a
  1370.               modal Dialog is visible
  1371.  
  1372.           VOptions constants
  1373.             DefaultOpts        behavior most like Turbo Vision
  1374.             {TgStaticText,TgParamText}
  1375.                 used with Opts field of text.Init's
  1376.               txDrawBackground
  1377.               txCentered
  1378.               txAdjustSize
  1379.               txAuto  = txCentered + txAdjustSize;
  1380.               To override the default font, set lower four bits
  1381.               of OPts field to name of font.
  1382.             {TgInputLine}
  1383.               KillInstantErase
  1384.               lnRightJustify
  1385.  
  1386.         GMENU6
  1387.             MenuBarheight : integer = 15;
  1388.                height of the MenuBar in pixels,
  1389.                minimum value is 15 if using Font8x14 as assigned in Init.
  1390.                      Set BEFORE initializing the menubar.
  1391.             MenuBoxheight : integer = Boxheight;
  1392.                 vertical line spacing in Box menus
  1393.             MouseSnapToMenuGrid : boolean = true;
  1394.                 causes mouse cursor to snap to a properly located Charlen
  1395.                 by Boxheight grid while a BoxMenu executes.
  1396.                 Set false to use current grid with BoxMenus.
  1397.             DefaultMenuFont : byte = Font8x14;
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.                                         23
  1404.  
  1405.  
  1406.  
  1407.         GVIEWS
  1408.           DefaultListViewerFont : byte = font8x14;
  1409.           TVColor    = $FFFF;   (used in TView field VColor)
  1410.               This value tells views to use TV palette color(s).
  1411.               currently used only in other units that use GViews
  1412.  
  1413.           AllowBothMButtons : boolean = false;
  1414.               used in Views to determine if they should react to the
  1415.               right mouse button as in Turbo Vision
  1416.           VOptions constants
  1417.             {TFrame drawing control}
  1418.               tfDrawBackground
  1419.                 draw a complete background rather than a partial one
  1420.  
  1421.         MCURSOR2
  1422.             The mouse has an hour glass "wait" cursor. Switch to it with
  1423.               MCur.SelectHourGlass, back with MCur.SelectStdCursor.
  1424.           EnableHourGlass : boolean = true;
  1425.             views in GSTDDLG and your views that use MCur.SelectHourGlass
  1426.               show the hourglass cursor only if EnableHourGlass is true.
  1427.  
  1428.         (**************************************************************)
  1429.  
  1430.         6. HOOKS For TVGraphic Users
  1431.         Embed your stuff without re-deriving all the library objects
  1432.  
  1433.         Color, Font     TView fields VColor,VFont available for storage
  1434.  
  1435.         Text Cursors
  1436.           In Turbo Vision, each View has a local text cursor and a set of
  1437.         TView  methods to manipulate it. TView.ResetCursor is  a  private
  1438.         method  which normally does the cursor drawing. In TVGraphic,  it
  1439.         has  been made public and virtual. Starting with ver 1.5,  Reset-
  1440.         Cursor does draw TV's intrinsic blinking cursor.
  1441.  
  1442.         User Overridable Function
  1443.           Boolean function UserHook is an added virtual TView method that
  1444.         takes  a  pointer and a TUserRec  as  parameters.  TView.UserHook
  1445.         returns  false and does not alter its parameters. (You  can  also
  1446.         use it as a procedure by using Pascal's Extended syntax.)   Over-
  1447.         ride  it in your descendants. TVGraphic does not call this  func-
  1448.         tion. See Reference section.
  1449.  
  1450.         User field
  1451.           TView has an added field Hook of record type TUserRec. TUserRec
  1452.         is multiple declared as a TRect, two pointers, and four integers.
  1453.         TVGraphic does not reference this field. See Reference section.
  1454.  
  1455.         (**************************************************************)
  1456.  
  1457.         7. INTRINSIC LOW MEMORY CHECKING DURING TGROUP.LOAD
  1458.                 and TCollection.Load
  1459.  
  1460.         Dangers in Using TCollection's
  1461.           Collections are so useful and widely used in Turbo Vision  that
  1462.  
  1463.  
  1464.                                         24
  1465.  
  1466.  
  1467.  
  1468.         one assumes they must be safe. Not so. In TV, anytime a  TCollec-
  1469.         tion  is being created or expanded, you may unexpectedly run  out
  1470.         of memory and abort with a RunTime error. This becomes especially
  1471.         likely  when  it is time to expand a large collection -  TV  must
  1472.         allocate space for a new array of item pointers before discarding
  1473.         any old memory. Further, it must find a single memory block large
  1474.         enough for this expanded pointer array.
  1475.           As  discussed in this section, TVGraphic avoids memory  induced
  1476.         runtime  errors for TCollection.Load from a Stream. Otherwise  it
  1477.         is  the same as TV. Users are encouraged to suggest general  pur-
  1478.         pose ways for TVGraphic to handle the other cases.
  1479.  
  1480.           Turbo  Vision has no intrinsic means  to check memory during  a
  1481.         TGroup.Load  or TCollection.Load. If a Group or  Collection  with
  1482.         many  subviews/subgroups/items runs out of memory  while  loading
  1483.         from disk, your program will halt with a runtime error.
  1484.  
  1485.           TVGraphic's TGroup.Load
  1486.         checks  for low memory after each view is inserted. It  exits  if
  1487.         LowMemory is true. This means that as long as each subview is  no
  1488.         larger  than  the safety pool (LowMemory, safety pool  -  see  TV
  1489.         documentation), your program won't halt and you can recover.
  1490.  
  1491.           When  TGroup.Load exits due to finding LowMemory, the Group  it
  1492.         was loading is not complete. You do not want to insert this Group
  1493.         in  your program - it could crash! To detect this condition,  use
  1494.         function  ValidView  on the pointer returned by S.Get()  or  test
  1495.         LowMemory  yourself.  ValidView will  automatically  dispose  the
  1496.         Group,  call the OutOfMemory method and return a nil  pointer  if
  1497.         LowMemory  is  true. If testing yourself, you  must  dispose  the
  1498.         Group.
  1499.  
  1500.           Note that there is no need to check if you are certain that the
  1501.         entire  Group you are loading needs less memory than  the  safety
  1502.         pool.
  1503.  
  1504.           TVGraphic's TCollection.Load
  1505.         checks  for  low memory after each item is loaded.  It  exits  if
  1506.         LowMemory  is  true and sets Count equal to the number  of  items
  1507.         loaded. The shortened collection is usable. If the collection  is
  1508.         being loaded as part of a TGroup, follow instructions for  TGroup
  1509.         above.
  1510.           Version 1.5 Update: The above load is still not perfectly safe.
  1511.         Problem occurs if there is not a big enough free block of  memory
  1512.         to  create  the array of pointers needed by a  TCollection  (four
  1513.         bytes  times the initial Limit of the collection plus any  expan-
  1514.         sion that has occurred}. In TV and earlier TVGraphic, this situa-
  1515.         tion  aborts with a runtime error. TVGraphic Ver1.5  TCollections
  1516.         will not abort. Ver1.5 checks that enough memory exists to  allo-
  1517.         cate  the  array.  If not, it builds  an  empty  collection  with
  1518.         Limit=1,  Count=0,  sets flag and exits. Method  Valid  has  been
  1519.         added to TCollection to check for errors during .Load. It returns
  1520.         an error number or 0. See TCollection.Valid in file REFER.DOC.
  1521.  
  1522.         (**************************************************************)
  1523.  
  1524.  
  1525.                                         25
  1526.  
  1527.  
  1528.  
  1529.  
  1530.         8. GWINDOWS.UNIT
  1531.  
  1532.           See also file REFER.DOC
  1533.  
  1534.         TSubWindow
  1535.           TSubWindow  is a descendent of TWindow designed to be  inserted
  1536.         into  another window. The only thing different is the  GetPalette
  1537.         method. It returns nil if its owner is a TWindow or a  descendant
  1538.         of  TWindow. Otherwise it calls TWindow.GetPalette. You  can  use
  1539.         TSubWindow  anywhere  you  would use a  TWindow.  Descendants  of
  1540.         TSubWindow inherit its capabilities.
  1541.           In versions of TVGraphic prior to 1.5, descendants of  TSubWin-
  1542.         dow  needed to override the GetPalette function. This  should  no
  1543.         longer be done.
  1544.  
  1545.         TPanWindow
  1546.           TPanWindow is a special window that has an Interior larger than
  1547.         the  screen  and  will pan across this Interior  when  the  mouse
  1548.         cursor  reaches the edge of the screen. Panning at the  sides  of
  1549.         the  screen  is automatic. Panning at the top and bottom  of  the
  1550.         screen  occurs if the user presses the right mouse  button.  With
  1551.         the mouse cursor at the top or bottom of the screen, the Message-
  1552.         Bar (unit GMenu: a view that temporarily overwrites the  MenuBar)
  1553.         appears  if vertical panning is possible to indicate this to  the
  1554.         user.
  1555.           Sizing the interior and the pan steps follows rules - see TPan-
  1556.         Window in file REFER.DOC.
  1557.  
  1558.         TShiftView
  1559.           TShiftView detects the mouse cursor at the screen edge for  the
  1560.         panning  function  of TPanWindow. The two views  communicate  via
  1561.         broadcast  commands. TShiftView also controls the  MessageBar  to
  1562.         display  and clear the 'press right mouse button to  shift'  mes-
  1563.         sage.
  1564.           TShiftView is invisible but it must still be in the right  spot
  1565.         on the screen. This is up to the user. Panning at the top of  the
  1566.         screen is only possible when the mouse cursor is over TShiftView.
  1567.         It  is  normally  sized to cover the top row  of  pixels  on  the
  1568.         screen. For example  Bounds.Assign(0, 0, GetMaxX, 0);
  1569.           Panning  at the bottom of the screen is enabled when the  mouse
  1570.         cursor is at its lowest allowed position on the screen. The exact
  1571.         position depends on the vertical pitch of the mouse cursor grid.
  1572.  
  1573.           To make all this work, you must initialize a TShiftView in your
  1574.         Application.Init  and  assign it to global  pointer  ShiftViewPtr
  1575.         BEFORE  calling TProgram.Init. Also, call  TShiftView.HandleEvent
  1576.         in  your application's HandleEvent BEFORE calling  TProgram.Hand-
  1577.         leEvent. See demo program for example.
  1578.  
  1579.         TShiftView gets its colors through the Menu palette.
  1580.  
  1581.         Mixing Windows and Views in a TPanWindow
  1582.           TSubWindows (not TWindow) and all other views can be used in  a
  1583.         TPanWindow.  However there are some restrictions. Mixing  subwin-
  1584.  
  1585.  
  1586.                                         26
  1587.  
  1588.  
  1589.  
  1590.         dows and non-selectable views (StaticText for example) is OK.  If
  1591.         you want to use F6,ShiftF6 keys to move through the windows, then
  1592.         insert  the subwindows on top of (after) all the other  subviews.
  1593.         If  you don't, the initial ordering of windows may shift  as  you
  1594.         use  F6,ShiftF6  or  a  window may  remain  trapped  behind  non-
  1595.         selectable views.
  1596.           Mixing  subwindows  with other selectable views  requires  some
  1597.         thought  and  has not been fully tested. Note that  when  a  view
  1598.         other   than  a  subwindow  is  selected,  the  window   commands
  1599.         (cmNext,cmPrev,etc.) will be disabled per standard TV. This means
  1600.         you  can't select a window with F6,ShiftF6 - yet if you press  F6
  1601.         while  a  window is selected, it will work. Consider  creating  a
  1602.         descendent  of  TPanWindow and clearing the  F6,ShiftF6  keyboard
  1603.         Events yourself in its HandleEvent. From this new HandleEvent, be
  1604.         sure to call  the TPanWindow.HandleEvent AFTER you modify  window
  1605.         command  behavior. If none of the subwindows you insert uses  the
  1606.         TAB  key, this could be coded to move through the subviews as  in
  1607.         Dialog  boxes.  Note that a selected view won't move to  the  top
  1608.         unless its ofTopSelect Option bit is set.
  1609.  
  1610.         TWinBackground
  1611.           If  you want a background for a window there are  two  choices.
  1612.         The  usual  is to set the tfDrawBackground flag in  the  VOptions
  1613.         field  of the window's Frame. Alternatively, insert  a  TWinBack-
  1614.         ground  view into the window. It will draw itself using the  same
  1615.         palette colors as the Frame would to fill the window. Or it  will
  1616.         draw itself using VColor if you set VColor to a color. Use  TWin-
  1617.         dow.GetMaxViewSize to find the Bounds for TWinBackground.Init.
  1618.           TWinBackground will work in a Window without a frame.
  1619.  
  1620.         (**************************************************************)
  1621.  
  1622.         9. TimerTick events
  1623.  
  1624.         evTimerTick events are generated by TProgram.GetEvent by  calling
  1625.         GetBiosTickEvent(Event)  if no other event has occurred.  GetBio-
  1626.         sTickEvent  checks the DOS timer-tick counter. These events  will
  1627.         occur  about every 18 milliseconds whenever no other  events  are
  1628.         being  processed.  If busy with other events, the event  will  be
  1629.         skipped.  TProgram.GetEvent calls HandleEvent to  distribute  the
  1630.         tick event to all views.
  1631.  
  1632.         The  tick count for the event is in Event.InfoLong. If  you  need
  1633.         to,  you  can also get the current timer tick  count  by  calling
  1634.         function GetBiosTicks. This returns a longint. DOS increments the
  1635.         tick count every 18.2 msec and resets it to 0 at midnight.
  1636.  
  1637.         To use Timer tick events:
  1638.            Set view's EventMask
  1639.                          EventMask := EventMask or evTimerTick;
  1640.            In view's HandleEvent, check if Event.What = evTimerTick
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.                                         27
  1648.  
  1649.  
  1650.  
  1651.         (**************************************************************)
  1652.  
  1653.         10. Blinking Text Cursor
  1654.  
  1655.         TV's Intrinsic Blinking Text Cursor
  1656.           Yes  its here and its new so it may not be entirely  bug  free.
  1657.         Using the cursor is a little different from Turbo Vision.
  1658.  
  1659.         To enable the cursor in a view, you need to set the view's Event-
  1660.         Mask  to include evTimerTick and later call ShowCursor. You  also
  1661.         MUST store the name of the font you are using in the view's VFont
  1662.         field.  (The cursor needs the name to see how big your font  is.)
  1663.         Graphic  mode doesn't support a blinking cursor in  hardware,  so
  1664.         you  are  responsible for hiding the text  cursor  when  directly
  1665.         calling  your  own redrawing methods. TVGraphic will  handle  the
  1666.         text  cursor  if  you  redraw by  calling  DrawView.   As  usual,
  1667.         TVGraphic handles the automatic screen redraws.
  1668.  
  1669.         It  helps to remember that you must erase the cursor just  BEFORE
  1670.         you change a view by redrawing. The cursor stores an image of the
  1671.         background  under  itself and restores this background  to  erase
  1672.         itself.  If the view has changed, the restored  background  won't
  1673.         match.  Use a call to ResetCursor(true) to momentarily erase  the
  1674.         cursor - the cursor will reappear when the next evTimertick event
  1675.         is  processed  by  HandleEvent. If you also want  to  change  the
  1676.         present cursor position, call SetCursor which calls ResetCursor.
  1677.  
  1678.         The  cursor will size itself and set its horizontal  movement  to
  1679.         match the font named in VFont. It calls TView functions VertText-
  1680.         Spacing,  VertTextOffset  and HorzTextOffset to  position  itself
  1681.         exactly  on  your text. If you choose not to  use  the  TVGraphic
  1682.         constants  Boxheight and ByOffset to space your text  vertically,
  1683.         you  will need to override VertTextSpacing and possibly  VertTex-
  1684.         tOffset  so they return your values. Similarly override  HorzTex-
  1685.         tOffset if you want it to return a value other than zero.
  1686.  
  1687.         See  utility function CalcVertTextOffset, the TView methods  men-
  1688.         tioned above plus SetCursor, ResetCursor in Reference file.
  1689.  
  1690.         (**************************************************************)
  1691.  
  1692.         11. Button choices
  1693.  
  1694.         TVGraphic  defaults  to Turbo Vision text style  buttons  in  its
  1695.         standard  views. But it lets you use TV style and bitmapped  but-
  1696.         tons  in  your own views. Bitmapped buttons respond  to  all  the
  1697.         Turbo  Vision  options but, being bitmapped, do so in  their  own
  1698.         style  as described in BITMAP.DOC. To unify the look of  the  two
  1699.         kinds of buttons, TVGraphic provides a variable
  1700.              TextButtonsMatchBitMapButtons : boolean = false;
  1701.         that  you can set. If true, text buttons draw with the same  look
  1702.         as bitmapped buttons.
  1703.  
  1704.         Creating Bitmapped buttons
  1705.           Use Borland's Resource Workshop or the Paintbrush program  that
  1706.  
  1707.  
  1708.                                         28
  1709.  
  1710.  
  1711.  
  1712.         comes  with Microsoft's Windows to create bitmaps for  your  but-
  1713.         tons. You create only one bitmap with the button's normal appear-
  1714.         ance.  TVGraphic will draw a button frame if the button  has  the
  1715.         correct  flag  set  so you do not need one in  your  bitmap.  The
  1716.         background  color of the bitmap should usually be matched to  the
  1717.         background  color  of TButton as described  in  BITMAP.DOC.  Each
  1718.         bitmap button also has a settable flag that will cause the button
  1719.         to draw with altered colors if the button is disabled.
  1720.  
  1721.         (**************************************************************)
  1722.  
  1723.         12. Compiling with TVGraphic
  1724.                List of Units, Paths, Caution on USES statements,Errors
  1725.  
  1726.           TVGraphic Unit names
  1727.  
  1728.                         for BP7.0 users:
  1729.                         unit fully up to TV2.0
  1730.             BMPDrvr         N/A
  1731.             GApp
  1732.             GBut            N/A
  1733.             GColors
  1734.             GDialogs
  1735.             GDrivers
  1736.             GMenu6
  1737.             GMsgBox
  1738.             GObjects        yes
  1739.             GStdDlg         yes
  1740.             GViews
  1741.             GWindow         N/A
  1742.             MCursor2        N/A
  1743.             MyGraph3        N/A
  1744.             Rodent          N/A
  1745.  
  1746.         Paths
  1747.         The  compiler must have a path to the standard Graph unit and  to
  1748.         the Turbo Vision TPU's. If you are using Borland's stroked fonts,
  1749.         then  a path to the fonts will be needed. The EGA/VGA  driver  is
  1750.         already  linked into TVGraphic and so doesn't need to be  on  the
  1751.         path.
  1752.  
  1753.         Compiler Version
  1754.         TVGraphic  is available in units for TP6.0 and 7.0. You must  use
  1755.         the units that match your version of the compiler. If not, expect
  1756.         the compiler's unit version mismatch error.
  1757.  
  1758.         Modified Turbo Vision units
  1759.         If  you  modify  the Interface section of the  Memory  unit,  the
  1760.         compiler will give you a Unit Version Mismatch error when you try
  1761.         to  compile  with TVGraphic. This could result from a  change  as
  1762.         small  as adding or changing a constant! This is due to  the  way
  1763.         Pascal units behave.
  1764.  
  1765.         Caution on USES statements
  1766.         The  compiler will not usually (should not) allow you  to  create
  1767.  
  1768.  
  1769.                                         29
  1770.  
  1771.  
  1772.  
  1773.         descendants  of  the objects in the Turbo Vision units  and  call
  1774.         them  from  within TVGraphic objects (it might  for  TObject  and
  1775.         TPoint).
  1776.  
  1777.         TO BE SAFE :
  1778.  
  1779.            ALWAYS descend from the TVGraphic versions of the object.
  1780.  
  1781.            Since most object names are the same as Turbo Vision,
  1782.              NEVER list in a USES statement
  1783.                  a Turbo Vision unit whose name corresponds
  1784.                  to a TVGraphic unit !
  1785.  
  1786.                  example: use  GObjects, never Objects
  1787.  
  1788.           In Borland demo programs, be sure to change the units in the
  1789.           USES statement to the corresponding TVGraphic units.
  1790.  
  1791.  
  1792.           ALSO
  1793.             Always refer to MyGraph3 in a uses statement, never Graph !
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.                                         30
  1831.