home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / C++-faq / turbovision / tvplus / part2 < prev    next >
Encoding:
Internet Message Format  |  1995-08-15  |  50.8 KB

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!news!uhog.mit.edu!news.mathworks.com!newshost.marcam.com!usc!howland.reston.ans.net!europa.chnt.gtegsc.com!newsfeed.internetmci.com!news.sprintlink.net!simtel!harbinger.cc.monash.edu.au!yarrina.connect.com.au!warrane.connect.com.au!godzilla.zeta.org.au!not-for-mail
  2. From: grove@zeta.org.au (Rachel Polanskis)
  3. Newsgroups: comp.os.msdos.programmer.turbovision,comp.answers,news.answers
  4. Subject: C++ Turbo Vision FAQ, part2/3
  5. Followup-To: poster
  6. Date: 15 Aug 1995 01:11:16 +1000
  7. Organization: Kralizec Dialup Unix Sydney, +61-2-837-1183 V.32bis
  8. Lines: 1453
  9. Approved: news-answers-request@mit.edu
  10. Message-ID: <40np2k$jms@godzilla.zeta.org.au>
  11. NNTP-Posting-Host: godzilla.zeta.org.au
  12. Summary: This article is a compilation of information on the use of, 
  13.          and resources for, Turbo Vision for C++ (Borland's application 
  14.          framework).
  15. Xref: senator-bedfellow.mit.edu comp.os.msdos.programmer.turbovision:5085 comp.answers:13671 news.answers:50723
  16.  
  17. Archive-name: C++-faq/turbovision/tvplus/part2
  18. Posting-Frequency: monthly
  19. Last-modified: 1995/08/14
  20. Version: 1.8
  21. URL: http://www.zeta.org.au/~grove/tvhome.html
  22.  
  23.  
  24.  
  25.    -----------------------------------------------------------------------
  26.    TECHINFO
  27.    -----------------------------------------------------------------------
  28.  
  29.    Borland International makes technical advice available through a series
  30.    known as TechInfo, abbreviated as TInnnn. The series is not limited to
  31.    TV and covers other topics relevant to Borland products. Each issue
  32.    covers a specific topic.
  33.  
  34.    All issues in this series mentioning Turbo Vision are listed here.
  35.  
  36.    TI1006 Overlaying Turbo Vision 1992.08.12
  37.    TI1011 Modal and Modeless Dialog Boxes using Turbo Vision 1992.08.12
  38.    TI1013 Making string lists using Turbo Vision 1992.08.12
  39.    TI1020 Understanding & Using Turbo Vision's Palette 1992.08.21
  40.    TI1021 How to extract text from a TEditor Buffer 1992.10.23
  41.    TI1022 Initialization Order of Objects & Turbo Vision 1992.12.03
  42.    TI1023 Persistent Objects using Turbo Vision 1992.12.23
  43.    TI1025 Optimizing Screen Updates with Turbo Vision v3.1 1992.12.23
  44.    TI1033 Example of derived TListViewer for Turbo Vision 1992.12.23
  45.    TI1158 A modal dialog from a modal dialog with Turbo Vision1992.11.11
  46.    TI1159 Graying Buttons with Turbo Vision 1992.11.11
  47.    TI1160 Dynamically modifying Turbo Vision menus1992.12.03
  48.    TI1296 Using Turbo Vision resource files 1993.10.25
  49.    TI1297 Example of password entry using a TInputLine 1993.10.25
  50.    TI1369 Changing the color of shadows in Turbo Vision 1993.10.25
  51.    TI1395 How to use HeapView in a Turbo Vision program 1993.10.25
  52.    TI1398 tools.h++ from Rogue Wave conflicts with Turbo Vision 1993.10.25
  53.    TI1532 Continuously updated message box in Turbo Vision1992.12.03
  54.    TI1541 Using cmReleasedFocus message to update a dialog box 1993.10.25
  55.    TI1549 Switching between text video modes in Turbo Vision 1993.10.25
  56.    TI1552 Turbo Vision example of determining cursor position 1993.10.25
  57.    TI1553 How to override freeItem for Collections 1993.10.25
  58.    TI1554 Context sensitive help example (Turbo Vision) 1993.08.30
  59.    TI1555 Example of a restricted InputLine (Turbo Vision) 1993.10.25
  60.    TI1557 Creating red error dialog boxes in Turbo Vision 1993.10.25
  61.    TI1558 Saving/Restoring the mouse state in Turbo Vision 1993.09.01
  62.    TI1701 Turbo Vision: Streaming a user defined dialog 1993.10.07
  63.    TI1707 Broadcast to close a Turbo Vision Modeless Dialog 1993.10.12
  64.    TI1708 Using setData to initialize dialog box contents 1993.10.25
  65.    TI1712 Turbo Vision Dialog Box (Modal/Modeless) Examples 1993.10.25
  66.    TI1720 How to disable a button in Turbo Vision 1993.10.25
  67.    TI1730 Inserting text into a Turbo Vision window 1993.10.21
  68.    TI1752 Rebuilding Turbo Vision 1.0x with Borland C++ 4.0 1994.01.13
  69.    TI1753 Using Turbo Vision 1.0x with Borland C++ 4.0 1994.01.13
  70.    TI1773 How to build DOS applications in Borland C++ 4.0 1994.01.25
  71.    TI1778 Common questions and answers about Borland C++ 4.0 1994.02.17
  72.  
  73.    These text files have been bundled together under the name
  74.    techinfo.zip for an easy download from the TVPlus ftp site.
  75.  
  76.    -----------------------------------------------------------------------
  77.    CDROM SOURCE CODE
  78.    -----------------------------------------------------------------------
  79.  
  80.    There are commercial compilations of source code and code snippets
  81.    written in various programming languages. The compiler (of the human
  82.    variety) will obtain material from various locations and sites for
  83.    distribution as CDROM collections.
  84.  
  85.    There are CDROM collections that include TV code. Such compilations can
  86.    greatly facilitate programming by providing consolidations of sources,
  87.    snippets, hints and tools. Much of the material is shareware; some of it
  88.    in the public domain.
  89.  
  90.    These compilations are a useful service provided that they do not breach
  91.    copyright. However, there are numerous CDROM services which are
  92.    advertised in computer magazines and which you can easily select without
  93.    recommendations from here.
  94.  
  95.    -----------------------------------------------------------------------
  96.              The discussion list
  97.    -----------------------------------------------------------------------
  98.  
  99.    The Turbo Vision discussion list is run as an unmoderated site from
  100.    Virginia Polytechnic Institute ('Virginia Tech'), Blacksburg, Virginia
  101.    USA.
  102.  
  103.    To subscribe to the discussion list:
  104.  
  105.        Send a message to Listserv@vtvm1.cc.vt.edu
  106.        Leave the subject header blank if you wish
  107.        In the body of your message, type the command:
  108.        SUBSCRIBE TURBVIS <your name>
  109.  
  110.    Expect confirmation of your subscription and a list of additional
  111.    Listserv commands which you should keep handy.
  112.  
  113.    Any question about Listserv should be addressed to your system
  114.    administrator.
  115.  
  116.    To send a message to the discussion list:
  117.  
  118.        Post your message to Turbvis@vtvm1.cc.vt.edu
  119.        Do not use this address to subscribe or unsubscribe
  120.        to the discussion list because, if you do, everyone
  121.        will get the commands intended only for Listserv.
  122.  
  123.    Note the distinction between Listserv and Turbvis - commands are sent to
  124.    Listserv; messages, to Turbvis.
  125.  
  126.    Check on posting to the discussion list before doing so.
  127.  
  128.    To unsubscribe to the Turbo Vision discussion list:
  129.  
  130.        Send a message to Listserv@vtvm1.cc.vt.edu
  131.        Leave the suject header blank if you wish
  132.        In the body of your message, put the command:
  133.        UNSUBSCRIBE TURBVIS <your name>
  134.  
  135.    -----------------------------------------------------------------------
  136.                UseNet News
  137.    -----------------------------------------------------------------------
  138.  
  139.    A Usenet newsgroup is a collection of the communications of various
  140.    subscribers about a predefined topic.
  141.  
  142.    SELECTING NEWGROUPS
  143.  
  144.    We have divided the newsgroups into four sections, moving from the most
  145.    to the least relevant:
  146.  
  147.       special interest: about Turbo Vision itself
  148.       programming: about your language of choice and other programming
  149.           subjects
  150.       various topics: about all manner of things that may, or may not,
  151.           be relevant
  152.       Usenet operations: about netiquette and other hints (good for
  153.           newbies).
  154.  
  155.    After selecting a newsgroup in which you are interested, you will be
  156.    presented a list of topics currently under discussion within that group.
  157.    Go for it.
  158.  
  159.    Application framework
  160.  
  161.    Just after the discussion group on TV went on line towards the end of
  162.    1992, this news group was established with a link to the discussion
  163.    list. It covers both the C++ and Pascal language version of the
  164.    software.
  165.  
  166.            comp.os.msdos.programmer.turbovision
  167.  
  168.    Language
  169.  
  170.    It goes without saying that using the TV library will not make you self
  171.    sufficient in techniques or programming tools. These groups present an
  172.    opportunity to look further afield into the C++ language as a related
  173.    subject.
  174.  
  175.            alt.msdos.programmer
  176.            comp.lang.c++
  177.            comp.lang.c++.moderated
  178.            comp.msdos.programmer
  179.            comp.os.msdos.programmer
  180.            comp.std.c++
  181.  
  182.    Reference
  183.  
  184.    The following sites are somewhat chaotic, catch all sites and are
  185.    included on the basis that they specialise in FAQs on diverse topics.
  186.    They may be a bit like a junk shop but you are more than likely to find
  187.    a treasure or two - they are quite useful as a starting point in your
  188.    research on all kinds of interests.
  189.  
  190.            comp.answers
  191.            news.answers
  192.            UseNet news
  193.  
  194.    Usenet and its operation
  195.  
  196.            news.announce.newusers
  197.  
  198.    The purpose of this newsgroup is to discuss Usenet and the way it
  199.    operates.  Questions about netiquette, the Usenet FAQ, posting rules
  200.    and similar matters can be put to this group.
  201.  
  202.    USING NEWSGROUPS
  203.  
  204.    Each newsgroup has its own area of expertise and going outside this area
  205.    could bring down the wrath of the regulars. They like to keep the topic
  206.    tight and you should check to see if the subject you want to discuss is
  207.    pertinent to the particular group.
  208.  
  209.    In any event, it is to your own advantage to ensure you have the right
  210.    group for your posting as you will get a better answer from those
  211.    experienced in the subject than from someone who is merely acquainted
  212.    with the topic.
  213.  
  214.    Do not post test articles to an active newsgroup. Find a test group such
  215.    as alt.test designated for this purpose.
  216.  
  217.    Also see about posting to the Turbo Vision discussion list.
  218.  
  219.  
  220.    How
  221.  
  222.    As TV is produced in two language versions, postings to
  223.  
  224.            turbvis@vtvm1.cc.vt.edu or
  225.            comp.os.msdos.programmer.turbovision
  226.  
  227.    should bear a subject header that readily identifes the language version
  228.    if applicable to the topic under discussion. It make life a little
  229.    easier - it helps communication and gets the information sought in one
  230.    pass.
  231.  
  232.    When
  233.  
  234.    Before you resort to the net for a solution to your code problem, make
  235.    sure you have done your homework and have been through the following
  236.    steps:
  237.  
  238.       read the manual (it may happen to be lucid on your
  239.       particular problem);
  240.  
  241.       check ..\turbovision\demos and ..\turbovision\docdemos of TV;
  242.  
  243.       browse through the examples from ftp://ftp.borland.com;
  244.  
  245.       read the source code if you have it;
  246.  
  247.       refer to the relevant FAQ which is, in this case, TVPlus; and
  248.  
  249.       try to resolve the difficulty using whatever resources you have
  250.       available.
  251.  
  252.    Where
  253.  
  254.    If you still cannot solve the problem, post a question to
  255.  
  256.        turbvis@vtvm1.cc.vt.edu if you have access to e-mail or
  257.  
  258.        comp.os.msdos.programmer.turbovision if you only have
  259.        access to UseNet News.
  260.  
  261.    -----------------------------------------------------------------------
  262.                Handy ftp sites
  263.    -----------------------------------------------------------------------
  264.  
  265.    GENERAL FTP SITES
  266.  
  267.    These archives contain collections of files that may be of
  268.    interest and that may have duplicate material from other sites;
  269.    but there are some unique items at each site as well.
  270.  
  271.    ftp://ftp.borland.com
  272.        This site was dis-organised early in 1995.  There are Turbo Vision
  273.        files to be found at /pub/techinfo/techdoc/language/c++/bcpp - if
  274.        you can detect which one are TV.  The LARN like maze to
  275.        /pub/techinfo/techdoc/language/c++/bcpp/ti contains the TI
  276.        series.
  277.    ftp://ftp.ee.und.ac.za
  278.        Of special interest here are a graphical version of TV and
  279.        patches for porting TV to other compilers. This site is very slow
  280.        if you are accustomed to US ftp speeds.
  281.    ftp://ftp.pharlap.com
  282.        This site contains patches for the Pharlap DOS extender to work
  283.        with TV.
  284.    ftp://garbo.uwasa.fi
  285.        This is the Garbo Archives sited in sunny Finland. There are
  286.        libraries for database applications and C++ sources which are
  287.        suitable for use with TV.
  288.    ftp://oak.oakland.edu
  289.        This is a popular site for all kinds of code. The turbovis
  290.        directory contains code listings for C++ TV1.03 and TV2.0 (and
  291.        Pascal Turbo Vision).
  292.    ftp://vtucs.cc.vt.edu
  293.        This site, amongst other things, archives the Turbo Vision
  294.        discussion list and comp.os.msdos.programmer.turbovision for both
  295.        the C++ and Pascal versions of TV.
  296.    CompuServe
  297.        CompuServe is one of many commercial alternatives to the Internet
  298.        which contains a Turbo Vision forum. For the information of CIS
  299.        customers, the TV files are located at BCPPDOS Library 11.
  300.  
  301.  
  302.    SPECIALIST FTP SITES
  303.  
  304.    This group of archives is devoted to a rather narrow purpose in
  305.    that they usually contain files that have originated from one
  306.    author or relate to one application.
  307.  
  308.    DosLynx Project: Kansas University <doslynx@falcon.cc.ukans.edu>
  309.        ftp://ftp2.cc.ukans.edu/pub/WWW/DosLynx/   The self-extracting
  310.        archive file name is DLX0_8A.EXE; the source file name is
  311.        SCR0_8A.ZIP.
  312.    Nelson, Roger <rnelson@mail.wsu.edu>
  313.        ftp://iris1.bsyse.wsu.edu   There are five directories which may
  314.        be of interest to TV programmers: ../pub/rvision (Pascal and C++
  315.        library), ../pub/rlib ../pub/language ../pub/latex2hyp
  316.        (LaTeX2hyp) and ../pub/ucscu
  317.    Nelson, Roger
  318.        http://www.eecs.wsw.edu/coea   The URL for WWW access to the site
  319.        referenced above.
  320.    Sierwald, Joern <sierwald@tu-harburg.d400.de>
  321.        ftp://uni-stuttgart.de/pub/systems/os2/programming/support
  322.        Patches to support TV with compilers other than Borland C++.
  323.    Werthy, William (Bill) <billw@eskimo.com>
  324.        ftp://ftp.eskimo.com   This site contains NEWSWERTHY, a TV offline
  325.        reader.
  326.  
  327.    TVPLUS FTP SITE
  328.  
  329.    TV files mentioned in TVPlus, and a few others besides, are
  330.    available from this site. The original file collection resulted
  331.    from the research of Rachel Polanskis and is presented with our
  332.    compliments; others have added to it.
  333.  
  334.    ftp://ftp.zeta.org.au
  335.        At present, limited access.  TVPlus is archived here;  there
  336.        is a selection of TV C++ files, some related C++ files and other
  337.        programming tools available from this site.
  338.  
  339.    File list
  340.  
  341.    The + indicates a new addition since the last change.
  342.  
  343.    altf1.zip: allows user to go back one page in help window
  344.    b31tv2.zip: use TV2 with BC++ 3.1 (not protected mode)
  345.    bc31tv2.zip: use TV2 with BC++ 3.1
  346.    bc40tv.zip: use TV1.03 with BC++ 4.x
  347.    blakbl.zip: implements black text on a black background
  348.  
  349.    clkclk.zip: click alternates clock between 12 and 24 h time
  350.    colord.zip: permits you to change the palette easily
  351.    colorsel.zip: selector dialog for application colours
  352.    csdude.zip: demo of TV and PXEngine, use with pmapp.zip to test
  353.    dbfram.zip: TV and PXEngine sample classes for input/output
  354.  
  355.    desklogo.zip: draw a background logo on desktop
  356.    dlgdsn46.zip: dialog design tool
  357.    dpmxcp.zip: DPMI Exception Handler Library for TV 2.0
  358.    dskstr.zip: how to stream desktop objects to file
  359.    dumb.zip: class for a dumb terminal object
  360.  
  361.    dyntxt.zip: dynamic version of TStaticText
  362.    ezhint.zip: demonstrates how to put hints on the status line
  363.    facetv.zip: advanced gadgets for TV; very interesting
  364.    farvt.zip: how to use far virtual tables in TV
  365.    fredtv.zip: TV library from BI (not tested)
  366.  
  367.    gfx210.zip: excellent graphics library for Turbo Vision
  368.    gvision.zip: Oliver Suciu's port of TV to g++
  369.    inplis.zip: edit a TListBox item using a TInputLine
  370.    kvbugs.zip: a bug list with many fixes for TV and BC
  371.    listvi.zip: control multiple lists with a common scrollbar
  372.  
  373.    makerez.zip: sample code for making resource file
  374.    mdbeep.zip: TV2, beeps on mouse click outside specified area
  375.    menunest.zip: example of cascading menu items
  376.    mibxb3.zip: message input box replacement, many features - BC3.1
  377.    mibxb4.zip: message input box replacement, many features - BC4.x
  378.  
  379.    mmagic.zip: generates menus
  380.    msgcls.zip: a status box like the IDE's and a message window
  381.    msglin.zip: messages put to the status line
  382.    msgs.zip: message passing from a dialog to a window
  383.    multbo.zip: mark multiple items in a collection - toggle values
  384.  
  385.    ntest.zip: for TVDT users, TMemo shoehorned into TView
  386.    option.zip: TCollection for a picklist similar to THistory
  387.    passwd.zip: password dialog and simple algorithm
  388.    phelp.zip: complete shareware replacement for TV's help system
  389.    pmapp.zip: TV1.03 and BC3.1 in protected mode - complete sources
  390.  
  391.    printq.zip: background printer object
  392.    progba.zip: progress bar utility
  393.    pxlist.zip: how to implement pxeng with TListBox
  394.    radio.zip: fix memory problem for large radio button cluster
  395.    readrez.zip: sample code reading a resource file
  396.  
  397.    savepal.zip: save and restore palette as resource
  398.    scrnsave.zip: demonstrates a screen saver using ISR routines
  399.    sdlg.zip: scrolling dialog box
  400.    sdlg2.zip: scrolling dialog box - revision
  401.    sg.zip: Turbo Vision Study Guide - teaches TV
  402.  
  403.    spread.zip: spreadsheet like object
  404.    strmfx.zip: TObjstrm patch for the library
  405.    sysfix.zip: sysint.asm patch for the library
  406.    sysint.zip: sysint.asm patch for the library
  407.    tcombo.zip: a streamable combo box
  408.  
  409.    techinfo.zip: the Borland TechInfo series on TV
  410.    testhelp.zip: demo of help system with commentary
  411.    tde.zip: class extensions from TInputLine
  412.    tdtxt1.zip: updates tde.zip
  413.    tkeys_h.zip: uses CTRL- key hotkey combinations
  414.  
  415.    togmnu.zip: allows toggled items to appear in a menu
  416.    tlang.zip: how to change language at runtime dynamically
  417.    tpictu.zip: derived from TInputLine, a PDX style picture class
  418.    tprogb.zip: another progress bar utility
  419.    tpicture.zip: input line Paradox style
  420.  
  421.    ttlbar.zip: adds a title bar above the menu bar
  422.    ttywin.zip: TTY style class implementation
  423.    tv_bc4.zip: how to patch TV1.03/BC4.x
  424.    tv-mc3.zip: how to use Memcheck with TV1.03
  425.    tv_may.zip: patches TV1.03 for PharLap DOS extender
  426.  
  427.    tv103inf.zip: differences between TV 1.0 and TV 1.03
  428.    tv286_v6.zip: pharlap DOS extender patches for TV1.03
  429.    tv286_v7.zip: similar to above but in diff format
  430.    tv2dll.zip: patches source code to convert TV to DLL
  431.    tv2dll2.zip: further source code on converting TV to DLL
  432.  
  433.    tv2dll3.zip: further comment on converting TV to DLL
  434.    + tv2bug.zip: the latest bug release for TV2 (1995.06.07)
  435.    tv2pat.exe: more patches for TV2.0
  436.    tv2val.zip: validation classes for TV2.0
  437.    tvalid.zip: field validation object
  438.  
  439.    tvalid2.zip: field validation object - later version
  440.    tvalt.zip: graphics library for Turbo Vision
  441.    tvalt2tx.zip: alternate to tvalt.zip (originally tvalt2.txt)
  442.    tvapform.txt: plain text proforma - applications catalogue entry
  443.    tvbugs.zip: the current bug list for TV 1.03 February 1994
  444.  
  445.    tvcolr.zip: dynamic selection of palette
  446.    tvdbf.zip: scrollbar using long, not ushort - PXEngine demo
  447.    + tvdpmxcp.zip: TV DPMI exception handler for BC4.x and TV2
  448.    tvdprj.zip: project file for BC4.x
  449.    tvfix.zip: older patches for TV1.03
  450.    tvg121.zip: library of graphics routines
  451.  
  452.    tvhint.zip: demonstrates how to put hints on the status line
  453.    tvicon.zip: example of making windows iconic
  454.    tvmemchk.zip: memory checking utility for compiling
  455.    tvmemo.zip: memo implementation of THistory
  456.    tvoprj.zip: BC4.x project for TV1.03 overlays
  457.  
  458.    tvpal.zip: palette routines for TV
  459.    tvpatch.zip: Joern Sierwald's patches
  460.    tvplus01.zip: TVPlus 1(1995)1 ie, as at January 1995
  461.    tvplus02.zip: TVPlus 1(1995)2 ie, as at Febuary 1995
  462.    tvplus03.zip: TVPlus 1(1995)3 ie, as at March 1995
  463.  
  464.    tvplus04.zip: TVPlus 1(1995)4 ie, as at April 1995
  465.    tvplus05.zip: TVPlus 1(1995)5 ie, as at May 1995
  466.    tvplus06.zip: TVPlus 1(1995)6 ie, as at June 1995
  467.    tvplus07.zip: TVPlus 1(1995)7 ie, as at July 1995
  468.    tvplus08.zip: latest TVPlus for use with a browser offline
  469.  
  470.    tvrw.zip: resource workshop
  471.    tvspawn.zip: spawns programmes without destroying desktop
  472.    tvtool17.zip: library of extensions and miscellaneous
  473.    tvtoys.zip: improves TV help and VGA and VESA
  474.    tvwork.zip: TVWorkshop - generates C++ source
  475.  
  476.    txtxit.zip: print text to screen after exiting TV
  477.    user.zip: TListBox and PXEng example
  478.    uses.zip: all the defines for TV1.03 in one header file
  479.    ve2tv1.zip: virtual memory editor for TV1.03, BC3.1 & BC4.x
  480.    ve2tv2.zip: virtual memory editor for TV2.0
  481.  
  482.    vtv.zip: demonstration menu bar generator
  483.    welstead.zip: examples of scientific data dialog box
  484.    xpwndg.zip: exploding windows and dialog boxes
  485.  
  486.  
  487.    -----------------------------------------------------------------------
  488.                  The World Wide Web
  489.    -----------------------------------------------------------------------
  490.  
  491.    We trust that these links to other World Wide Web pages contribute to
  492.    the usefulness of TVPlus.
  493.  
  494.    ON THE C++ LANGUAGE
  495.  
  496.    The C++ Virtual Library
  497.       This site <http://info.desy.de/user/projects/> contains
  498.       information about C++ products, libraries, tutorials, tools and
  499.       utilities.
  500.    The Yahoo Database (C/C++ list)
  501.       This listing whose URL is <http://www.yahoo.com/Computer/Languages/>
  502.       is from the well known Web database, Yahoo
  503.    The Captain's Log (C/C++ FAQ)
  504.       The URL for this home page, which is found at the University of
  505.       Liverpool (UK), <http://hpux.csc.liv.ac.uk/users/workexp/wk/>
  506.       deals with C++ and object oriented programming - and C.
  507.    The DESY user information
  508.       This page whose URL is <http://info.desy.de/general/> is devoted
  509.       to object oriented programming and presented by Deutsches
  510.       Electronen-Synchrotron in Hamburg, Germany.
  511.    The Borland WebPage
  512.       Borland's effort on the WWW is at <http://www.borland.com/>. It
  513.       covers a great deal more than just Turbo Vision material.
  514.  
  515.    ON VARIOUS TOPICS
  516.  
  517.    FAQs on various topics
  518.       This home page at <http://www.cis.ohio-state.edu/hypertext/faq/>
  519.       for Ohio State (US) presents FAQs in hypertext format.
  520.  
  521.  
  522.    -----------------------------------------------------------------------
  523.             Selected answers on programming
  524.    -----------------------------------------------------------------------
  525.  
  526.    Although the division of the subject matter into the two headings listed
  527.    here is somewhat artificial (because written explanations are often
  528.    accompanied by code examples), we are adopting such a division to cater
  529.    for both methods, only one of which may be used to illustrate the point
  530.    in question.
  531.  
  532.          Articles
  533.          Code snippets
  534.  
  535.    At this stage, it is proposed that material in these two headings be
  536.    divided into twelve sections but this depends very much on the material
  537.    that comes to hand. Select here if you want to get an overview.
  538.  
  539.    PLEASE NOTE: There are very few articles in this section of TVPlus at
  540.    present. It is our aim, with your help, to provide a reasonably
  541.    comprehensive collection of the FAQs.
  542.  
  543.    If you have a contribution to or comments on this chapter, please see
  544.    the section, 'Wanted!'.
  545.  
  546.    -----------------------------------------------------------------------
  547.    ARTICLES
  548.    -----------------------------------------------------------------------
  549.  
  550.  
  551.    Choose from this list for your selected topic:
  552.  
  553.    Application and desktop
  554.    Menus and statusline*
  555.    Dialog boxes
  556.    Windows and editors
  557.    Online help*
  558.    Palettes
  559.    Streams*
  560.    Collections and resource files*
  561.    Graphics
  562.    Databases and interfacing Turbo Vision*
  563.    Overlays and memory
  564.  
  565.    [* the heading requires elaboration]
  566.  
  567.    ----------------------------------------------------------------------
  568.  
  569.    APPLICATION AND DESKTOP
  570.  
  571.    Child programme re-direction
  572.  
  573.    -----------------------------------------------------------------------
  574.  
  575.    Child Programme Standard-Device Redirection
  576.  
  577.    Version  None specified
  578.    Terms    None used
  579.  
  580.    This article outlines one approach to simultating a DOS box under
  581.    MS-Windows so that, when the utility runs, its stdout is redirect to a
  582.    window in the TV application.
  583.  
  584.    First write a character device driver that places standard output on the
  585.    screen where you want it.
  586.  
  587.    Then from within your programme
  588.  
  589.        duplicate the standard-device handle with Interrupt 21H function 45h;
  590.        save the duplicate handle;
  591.        open the new device;
  592.        with the new device handle retreived in step 3, modify the standard -
  593.        device handle by using Force Duplicate Handle, Interupt 21H function
  594.      46H;
  595.        run the child process;
  596.        restore the standard-device handle saved in step 2 with Force 
  597.       Duplicate Handle, Interupt 21H function 46H; and
  598.        close new device.
  599.  
  600.    You will need to refer to your Borland C++ Manual and a MS-DOS
  601.    Programmer's reference for the details.
  602.  
  603.    -----------------------------------------------------------------------
  604.  
  605.    DIALOG BOXES
  606.  
  607.    Arranging input layout
  608.    Chaining dialog boxes
  609.    Scrolling dialog boxes
  610.    Paging dialog boxes
  611.    Progress Bar
  612.  
  613.    -----------------------------------------------------------------------
  614.  
  615.    Arranging input layout
  616.    
  617.    Version  None specified
  618.    Terms    TDialog
  619.  
  620.    There have been a number of alternative methods proposed to put data
  621.    entry fields to a dialog box that does not easily accommodate them:
  622.    
  623.      scrolling dialog box
  624.  
  625.        see article on scrolling dialog box
  626.        see code SDLG2.ZIP in TVPlus file collection
  627.  
  628.      chaining dialog boxes
  629.  
  630.        see article on chaining dialog boxes
  631.        see code in TI1158 in Borland TI series
  632.  
  633.      paging dialog boxes
  634.  
  635.        see article on paging dialog boxes
  636.  
  637.    ---------------------------------------------------------------------
  638.  
  639.    Chaining dialog boxes
  640.  
  641.    Version  None specified
  642.    Terms    None specified
  643.  
  644.    This article suggests a way to chain dialog boxes where information from
  645.    the user is too much for one screen alone.
  646.  
  647.    Create global instance variables of the dialog boxes in your main
  648.    program. Then attach commands to the appropriate buttons in the dialog
  649.    boxes, and make sure they are all different.
  650.  
  651.    Create an event handler for each box, so that when it sees the button
  652.    command, it issues a broadcast message to the desktop using that event
  653.    as part of the broadcast.
  654.  
  655.    Create an event handler for the desktop which can respond to the
  656.    broadcast messages, and depending on the particular message, the desktop
  657.    will create the appropriate dialog box.
  658.  
  659.    -----------------------------------------------------------------------
  660.  
  661.    Scrolling dialog box
  662.  
  663.    Version  None specified
  664.    Terms    TDialog; TView::origin; TView::size; TGroup::redraw;
  665.  
  666.    One way to manage more input fields than would normally fit into one
  667.    dialog box is to make the dialog scroll. This can be done because a
  668.    subview of a view can have "bounds" that place all or part of it outside
  669.    the bounds of the owner - the portion outside of the owner simply does
  670.    not get drawn.
  671.  
  672.    Thus you can rig it so that the dialog responds to a "down arrow" press
  673.    by decreasing origin.y for all of the subviews by 1, the "page down" key
  674.    decreases origin.y for all of the subviews by the TDialog->size.y - 2
  675.    (the minus 2 because of the line at the top and bottom used by the
  676.    frame), and so on. After changing each TViews->origin.y, call
  677.    TDialog->redraw.
  678.    
  679.    You can also place restrictions on how far up/down the scrolling is
  680.    allowed to go. For example, to stop scrolling downwards when the
  681.    "bottom" view is entirely visible, test for TVPBottomView->origin.y +
  682.    TVPBottomView->size.y = TDialog->size.y.
  683.  
  684.    Do not blindly scroll every subview - some things, such as the frame,
  685.    should stay where they are - i.e., set the GrowMode flag for every view
  686.    appropriately and test it before adjusting its origin/size fields.
  687.  
  688.    The contributor had not used a scroll bar for this, but claimed it works
  689.    very well with the arrow keys and the page up/down keys.
  690.  
  691.    ----------------------------------------------------------------------
  692.  
  693.    Paging dialog box
  694.  
  695.    Version  None specified
  696.    Terms    TDialog; TView::hide; TNSCollection
  697.  
  698.    You can have a "paged" dialog by inserting all of the controls into the
  699.    dialog in pages. At any one time, only one page's controls would be
  700.    visible; you hide() the others.
  701.  
  702.    This probably sounds complex, but its actually pretty simple. Create a
  703.    collection that stores TView pointers - the only real added
  704.    functionality is NOT to destroy the views:
  705.  
  706.    class TNSViewCollection : public TNSCollection {
  707.     public:
  708.       TNSViewCollection( ccIndex lim, ccIndex d )
  709.       : TNSCollection( lim, d ) {
  710.       shouldDelete = False; }
  711.     };
  712.  
  713.    Now consider if you have a "collection-of-collections". Here, the major
  714.    reason for subclassing is that freeItem() correctly destroys the
  715.    contained collections:
  716.  
  717.    class TNSCollCollection : public TNSCollection {
  718.     public:
  719.       TNSCollCollection( ccIndex  lim, ccIndex d )
  720.       : TNSCollection( lim, d ) {}
  721.     private:
  722.       virtual void freeItem( void* item ) {
  723.           destroy( (TNSCollection*) item );
  724.           }
  725.     };
  726.  
  727.     Now you can subclass a dialog which has a collection-of- collections
  728.     with each item representing a page in the dialog. Each contained
  729.     collection holds pointers to all the TViews that make up that page. An
  730.     example base class might look like:
  731.  
  732.     class TPagedDialog : public TDialog {
  733.     public:
  734.       TPagedDialog( const TRect& r, const char* s,
  735.         int nrPages ) :
  736.         TWindowInit( TPagedDialog::initFrame ),
  737.         TDialog( r, s ),
  738.         pageList( new TNSCollCollection(nrPages,0) ),
  739.         curPage(0) {
  740.         for( int i = 0; i < nrPages; i++ )
  741.           pageList->insert( new TNSViewCollection(0,5) );
  742.           }
  743.         virtual void shutDown() {
  744.           TDialog::shutDown();
  745.           destroy( pageList );
  746.           pageList = 0;
  747.           }
  748.         virtual void displayPage( int pageNumber ) {
  749.           if( pageNumber >= 0 &&
  750.           pageNumber < pageList->getCount() &&
  751.           pageNumber != curPage ) {
  752.         lock();
  753.         ((TNSCollection*) pageList->at(curPage))->
  754.           forEach( hideView, 0 );
  755.         curPage = pageNumber;
  756.         ((TNSCollection*) pageList->at(curPage))->
  757.           forEach( showView, 0 );
  758.         unlock();
  759.         }
  760.           }
  761.         static void hideView( void* v, void* ) {
  762.           ((TView*)v)->hide();
  763.           }
  764.         static void showView( void* v, void* ) {
  765.           ((TView*)v)->show();
  766.           }
  767.         void pageInsert( TView* view ) {
  768.           insert( view );
  769.           ((TNSCollection*) pageList->at(curPage))->
  770.           insert( view );
  771.           }
  772.        TNSCollection* pageList;
  773.     };
  774.     // The author has written all these members as inline.
  775.     // In use, you would put them in a source file.
  776.  
  777.     For this base class, you start with page[0] as the active page stored in
  778.     curPage. When you want to hide this page and display a different one,
  779.     you call TPagedDialog::displayPage(pg) with the new page number.
  780.  
  781.     The author also put in TPagedDialog::pageInsert() so that it is easy to
  782.     build the dialog. You start by pageInserting all the controls for page
  783.     [0]. When you are done, you set page[1] as active by calling
  784.     displayPage(1) and pageInsert the views for page[1]; etc.
  785.  
  786.     The member function TPagedDialog::displayPage() goes through the list of
  787.     the views that are currently visible and hides them, and then goes
  788.     through the list of views for the new page and shows them. This may not
  789.     leave the focus where you want it when a new page is displayed - so you
  790.     need to add code to do that.
  791.  
  792.     If you want a view to permanently be in the dialog, i.e. visible in all
  793.     the pages, insert() it directly and do not use TPagedDialog::
  794.     pageInsert(). Note, however, that it may end up being a bit goofy as far
  795.     as the tabbing order goes. If it is the first view inserted (counting
  796.     the ones in the pages), then it is OK - it will always be the first tab
  797.     view. If it is at the end of the first page, the view is equivalent to
  798.     being first in all the subsequent pages (which, tab- wise, is also OK).
  799.  
  800.     So, for example, you could subclass from TPagedDialog and have two
  801.     "permanent" buttons (views) - a Prev button, and a Next button. You
  802.     would start out with the Prev button disabled, and Next enabled. You
  803.     would then override TPagedDialog::displayPage() so that it updates the
  804.     buttons. For example:
  805.  
  806.     virtual void displayPage( int pageNr ) {
  807.     TPagedDialog::displayPage( pageNr );
  808.       if( pageNr == 0 ) {
  809.           disableCommand( cmPrevBtn );
  810.           enableCommand( cmNextBtn );
  811.           }
  812.       else {
  813.           enableCommand( cmPrevBtn );
  814.           if( pageNr != pageList->getCount()-1 )
  815.           enableCommand( cmNextBtn );
  816.           else
  817.           disableCommand( cmNextBtn );
  818.           }
  819.     }
  820.  
  821.     This assumes that cmNextBtn and cmPrevBtn are disable-able commands (in
  822.     the range of 100-255) and are assigned to these buttons.
  823.  
  824.     Finally, override handleEvent() to handle page switching:
  825.  
  826.     void handleEvent( TEvent& event ) {
  827.       TPagedDialog::handleEvent( event );
  828.       if( event.what == evCommand )
  829.         if( event.message.command == cmPrevBtn )
  830.           displayPage( curPage-1 );
  831.         else if( event.message.command == cmNextBtn )
  832.           displayPage( curPage+1 );
  833.         else
  834.           return;
  835.         clearEvent( event );
  836.       }
  837.  
  838.     ----------------------------------------------------------------------
  839.  
  840.     Progress Bar
  841.  
  842.     Version  None specified
  843.     Terms    TStaticText; TView::setData
  844.  
  845.     To create a progress bar, you can derive a class from TStaticText which
  846.     will allow setting of colour and re-displaying the string (via a
  847.     setData() member function). This can be used to display a bar and then
  848.     periodically update it.
  849.     
  850.     -----------------------------------------------------------------------
  851.  
  852.     PALETTES
  853.  
  854.     Palette with LCD displays
  855.  
  856.     -----------------------------------------------------------------------
  857.  
  858.     Palette with LCD displays
  859.  
  860.     Version  None specified
  861.     Terms    TPalette
  862.  
  863.     TV has three predefined palettes as the manual describes (1992, pp
  864.     119-126, 384-386 and 455). Normally, the appropriate palette is selected
  865.     when you start the application, but with LCD displays it does not always
  866.     do that. You can obtain an example of how to set the palette from the
  867.     command line or a menu option by downloading TVCOLR.ZIP from the TVPlus
  868.     file collection
  869.  
  870.    -----------------------------------------------------------------------
  871.  
  872.    WINDOWS AND EDITORS
  873.  
  874.    File Editor: TV does not support files greater than 64kb. There is a
  875.    shareware TV extension - named ve2tv1.zip or ve2tv2.zip - which does so;
  876.    designed by Eric Woodruff, it allows some professional file editing
  877.    features that can make TV a useful editing platform; and the source code
  878.    is required as some specific objects are renamed. You could also
  879.    recompile the TV source using one of the TV ports to djgpp, gcc/emx,
  880.    etc.
  881.  
  882.    Word wrapping editor: This is unsupported in TV. There is a TV extension
  883.    - named tvwrdwrp.zip - which provides word wrapping functionality but
  884.    requires the recompiling of the source code.
  885.     
  886.    ----------------------------------------------------------------------
  887.  
  888.    GRAPHICS
  889.  
  890.    Turbo Vision can be made to run in graphics mode. However, the point to 
  891.    bear in mind is that, as TV is designed from the ground up as a text
  892.    mode application, the performance of the screen redraws can suffer.
  893.    There are two options: if graphics has only a secondary role in your
  894.    program, try switching screen modes and doing your graphics processing
  895.    there; if you need a complete graphics system, use one of the TV
  896.    libraries available.
  897.  
  898.    -----------------------------------------------------------------------
  899.  
  900.    OVERLAYS AND MEMORY
  901.  
  902.    TV is large. It can add 200 to 300 kb onto your application. Bear this
  903.    in mind when you are writing a program using it. It is generally well
  904.    behaved provided that you have made the appropriate patches to your
  905.    compiler and you have used the destroy() operator as suggested.
  906.  
  907.    If you need more memory, the use of overlays can be be added. This
  908.    involves the recompiling of the source code, to allow for the division
  909.    of files into separate libraries. If you do not have the sources, there
  910.    is not much you can do... Overlaying your application will present other
  911.    factors that you will have to deal with. They can slow down execution,
  912.    the tracking down of bugs is more difficult and you cannot compress an
  913.    overlayed program.
  914.  
  915.    You can use a DOS extender. This is available in BC4.x but is not
  916.    supported in BC31. You can try a third party DOS extender such as
  917.    Pharlap's, but there is a fee for executables distributed with it. There
  918.    are patches that can be used with the TV source to allow Pharlap's
  919.    extender to be used with TV.
  920.  
  921.  
  922.    -----------------------------------------------------------------------
  923.    CODE SNIPPETS
  924.    -----------------------------------------------------------------------
  925.  
  926.    The basis of selecting code for inclusion within this heading is its
  927.    useful in demonstrating TV coding techniques. This is the practical
  928.    aspect of the questions covered in the section, Articles.
  929.  
  930.    Choose from this list to view code snippets on your selected topic
  931.  
  932.    Application and desktop
  933.    Menus and statusline*
  934.    Dialog boxes
  935.    Windows and editors*
  936.    Online help*
  937.    Palettes
  938.    Streams*
  939.    Collections and resource files
  940.    Graphics*
  941.    Databases and interfacing Turbo Vision*
  942.    Overlays and memory*
  943.  
  944.    [*  the heading requires elaboration]
  945.  
  946.    -----------------------------------------------------------------------
  947.  
  948.    APPLICATION AND DESKTOP
  949.  
  950.    Spawning programmes
  951.  
  952.    -----------------------------------------------------------------------
  953.  
  954.    Spawning programmes
  955.  
  956.    Version  None specified
  957.    Author   Frank Hohmann <mailto:fhohmann@rols1.oec.uni-osnabrueck.de>
  958.    Terms    TApplication::suspend; TApplication::resume; overload
  959.  
  960. /*
  961.    TVSPAWN.CPP
  962.    This is a demo for calling programs from within the TV environment
  963.    without destroying the desktop.
  964.    The approach is as follows:
  965.    - overload TApplication::suspend() and TApplication::resume().
  966.      We must do this to avoid TScreen::suspend() and TScreen::resume()
  967.      to be executed.
  968.    - display a non-movable, non-resizable TWindow on the screen
  969.      (see class TSwanWindow)
  970.    - define a window() (see conio.h) that covers the client
  971.      area of our TSpawnWindow and set "directvideo=1"
  972.    - redirect INT 29h "fast console output" to an own interrupt
  973.      routine (INT 29h is called everytime a character is written to
  974.      stdout). This routine calls cprintf() to display the character
  975.    - proceed with spawning a child process as described in
  976.      Borland examples
  977.    - restore INT 29h to the original
  978.    
  979.    I tested the above on different standard text modes and encountered
  980.    no problems. Nevertheless this example comes without any warranty.
  981.  
  982.    Please report any experiences/errors/enhancements to
  983.      Frank Hohmann
  984.      University of Osnabrueck, Germany
  985.      e-mail: fhohmann@rols1.oec.uni-osnabrueck.de
  986. */
  987.  
  988.    #include <stdlib.h>        // for system()
  989.    #include <dos.h>           // for setvect(), getvect()
  990.    #include <conio.h>         // cprintf(), window()
  991.    #include <stdio.h>
  992.  
  993.    #define Uses_TEvent
  994.    #define Uses_TProgram
  995.    #define Uses_TApplication
  996.    #define Uses_TKeys
  997.    #define Uses_TRect
  998.    #define Uses_TMenuBar
  999.    #define Uses_TSubMenu
  1000.    #define Uses_TMenuItem
  1001.    #define Uses_TStatusLine
  1002.    #define Uses_TStatusItem
  1003.    #define Uses_TStatusDef
  1004.    #define Uses_TDeskTop
  1005.    #define Uses_TWindow
  1006.    #define Uses_TSystemError
  1007.    #define Uses_TEventQueue
  1008.    
  1009.    #include <tv.h>
  1010.  
  1011.    #define INT_NUMBER 0x29        // interrupt for "fast console output"
  1012.    #define DOS_CMD    "MEM /C"    // command to spawn for test purpose
  1013.    
  1014.    const int cmNewSpawnWin   = 100;
  1015.    const int cmSpawn      = 1000;
  1016.  
  1017.  
  1018.    class TVApp : public TApplication {
  1019.      public:
  1020.        TVApp();
  1021.        static TStatusLine *initStatusLine( TRect r );
  1022.        static TMenuBar *initMenuBar( TRect r );
  1023.        virtual void handleEvent( TEvent& event);
  1024.        void mySpawnWindow();
  1025.        virtual void suspend();
  1026.        virtual void resume();
  1027.      };
  1028.  
  1029.    class TSpawnWindow : public TWindow {
  1030.      public:
  1031.        TSpawnWindow( const TRect& r, const char *aTitle, short aNumber );
  1032.        virtual void handleEvent(TEvent& event);
  1033.        void spawn();
  1034.      };
  1035.  
  1036.    // ------------------- TVApp
  1037.    TVApp::TVApp() : 
  1038.      TProgInit( &TVApp::initStatusLine,
  1039.         &TVApp::initMenuBar,
  1040.         &TVApp::initDeskTop) {
  1041.       }
  1042.  
  1043.       TStatusLine *TVApp::initStatusLine(TRect r) {
  1044.       r.a.y = r.b.y - 1;     // move top to 1 line above bottom
  1045.       return new TStatusLine( r,
  1046.       *new TStatusDef( 0, 0xFFFF ) +
  1047.       *new TStatusItem( 0, kbF10, cmMenu ) +
  1048.       *new TStatusItem( 0, kbAltF3, cmClose ) +
  1049.       *new TStatusItem( "~Alt-X~ Exit", kbAltX, cmQuit ) );
  1050.        }
  1051.  
  1052.    TMenuBar *TVApp::initMenuBar( TRect r ) {
  1053.      r.b.y = r.a.y + 1;    // set bottom line 1 line below top line
  1054.      TMenuBar *m =
  1055.      new TMenuBar( r,
  1056.      *new TSubMenu( "~S~pawn", kbAltF )+
  1057.       *new TMenuItem( "~T~est",  cmNewSpawnWin,   kbF4, hcNoContext, "F4" )+
  1058.        newLine()+
  1059.       *new TMenuItem( "E~x~it", cmQuit, cmQuit, hcNoContext, "Alt-X" )       );
  1060.        return m;
  1061.       }
  1062.  
  1063.     void TVApp::handleEvent(TEvent& event) {
  1064.       TApplication::handleEvent(event);
  1065.       if( event.what == evCommand ) {
  1066.       switch( event.message.command ) {
  1067.           case cmNewSpawnWin:
  1068.           mySpawnWindow();
  1069.           break;
  1070.            default:
  1071.           return;
  1072.            }
  1073.       clearEvent( event );       // clear event after handling
  1074.       }
  1075.       }
  1076.  
  1077.     void TVApp::mySpawnWindow() {
  1078.       TRect r( 2, 2, 78, 21 );
  1079.  
  1080.       // insert a new TSpawnWindow
  1081.       TSpawnWindow *window = new TSpawnWindow ( r, "Output", wnNoNumber);
  1082.       deskTop->insert(window);
  1083.       // ... and let it do its job
  1084.       message(window, evBroadcast, cmSpawn, NULL);
  1085.       }
  1086.  
  1087.     // We must override TApplication::suspend()
  1088.     // since we don't want TScreen::suspend() to be executed
  1089.     void TVApp::suspend() {
  1090.       TSystemError::suspend();
  1091.       TEventQueue::suspend();
  1092.       }
  1093.  
  1094.     // We must override TApplication::resume()
  1095.     // since we don't want TScreen::resume() to be executed
  1096.     void TVApp::resume() {
  1097.       TEventQueue::resume();
  1098.       TSystemError::resume();
  1099.       }
  1100.  
  1101.     // ------------------- TSpawnWindow
  1102.     TSpawnWindow::TSpawnWindow( const TRect& r, const char *aTitle,
  1103.       short aNumber) : TWindow( r, aTitle, aNumber),
  1104.       TWindowInit( &TSpawnWindow::initFrame) {
  1105.       
  1106.       flags = 0; // no Zoom/close/move style bits
  1107.       }
  1108.  
  1109.     #pragma argsused
  1110.     void interrupt NewInt29( unsigned bp, unsigned di, unsigned si,
  1111.       unsigned ds, unsigned es, unsigned dx, unsigned cx,
  1112.       unsigned bx, unsigned ax, unsigned ip, unsigned cs,
  1113.       unsigned flags ) {
  1114.       // the character to be outputted must be taken from AL
  1115.      cprintf("%c", (ax &~ 0xFF00));
  1116.       // signal end of interrupt (EOI)
  1117.      outportb(0x20, 0x20);
  1118.       }
  1119.  
  1120.     void TSpawnWindow::spawn() {
  1121.       // first call our new suspend()
  1122.       TProgram::application->suspend();
  1123.  
  1124.       // ... then save old INT 29h vector and replace it with our own
  1125.       void interrupt (*OldInt29)(...) = getvect(INT_NUMBER);
  1126.       setvect(INT_NUMBER, (void interrupt (*)(...))NewInt29);
  1127.  
  1128.       // ... define a conio window that matches our TSpawnWindow's client area,
  1129.       // activate direct video and set the appropiate color
  1130.       window(origin.x+3, origin.y+3, origin.x + size.x -2, origin.y + size.y);
  1131.       directvideo = 1;
  1132.       textattr(getColor(2));
  1133.  
  1134.       // ... call some DOS commands (spawn() or system())
  1135.       printf("Executing %s\n", DOS_CMD);
  1136.       system(DOS_CMD);
  1137.       system("pause");
  1138.       
  1139.       // ... and restore our old environment
  1140.       setvect(INT_NUMBER, OldInt29);
  1141.       TProgram::application->resume();
  1142.  
  1143.       // finally close our TSpawnWindow
  1144.       close();
  1145.       }
  1146.  
  1147.     void TSpawnWindow::handleEvent(TEvent& event) {
  1148.       if( event.what == evBroadcast && event.message.command == cmSpawn ) {
  1149.     spawn();
  1150.     clearEvent(event);
  1151.     }
  1152.       else
  1153.     TWindow::handleEvent(event);
  1154.       }
  1155.  
  1156.     int main() {
  1157.       TVApp tvApp;
  1158.       tvApp.run();
  1159.       return 0;
  1160.       }
  1161.  
  1162.    -----------------------------------------------------------------------
  1163.  
  1164.    DIALOG BOXES
  1165.  
  1166.    Cursor control
  1167.    Default value
  1168.    Exit method (1)
  1169.    Exit method (2)
  1170.    Password (1)
  1171.    Password (2)
  1172.  
  1173.    -----------------------------------------------------------------------
  1174.  
  1175.    Cursor movement
  1176.  
  1177.    Version  Not specified
  1178.    Terms    TDialog; TInputLine
  1179.  
  1180.    The standard behaviour in Turbo Vision for moving from one field to
  1181.    another within a dialog box is to use the TAB. The following code
  1182.    snippet shows how to modify this behaviour so that you can instead use
  1183.    ENTER or arrow keys to move to another field.
  1184.  
  1185.    // Override handleEvent for your dialog class with
  1186.    // the following:
  1187.  
  1188.    void TVDialog::handleEvent (TEvent &event) {
  1189.    if (event.what == evKeyDown) {
  1190.       switch (ctrlToArrow (event.keyDown.keyCode)) {
  1191.     case kbUp: {
  1192.         if (valid (cmCheck)) {
  1193.            selectNext (True);
  1194.            }
  1195.         clearEvent (event);
  1196.         break;
  1197.         }
  1198.      case kbEnter: {
  1199.         if (valid (cmCheck)) {
  1200.            selectNext (False);
  1201.            }
  1202.         clearEvent (event);
  1203.         break;
  1204.         }
  1205.      case kbTab:
  1206.         clearEvent (event);
  1207.         break;
  1208.      }
  1209.       }
  1210.    TDialog::handleEvent (event);
  1211.     return;
  1212.    }
  1213.  
  1214.    NB.  There are a number of class extensions available
  1215.    which provide code along such lines.
  1216.  
  1217.    -------------------------------------------------------------
  1218.  
  1219.    Default values
  1220.  
  1221.    Version  None specified
  1222.    Terms    TDialog; TInputLine
  1223.  
  1224.    This code example shows how to display a default value in a dialog box.
  1225.  
  1226.    TInputLine *control = new TInputLine(......);
  1227.    control->setData(buffer);
  1228.     // other stuff
  1229.    execView(dialog_with_TInputLine);
  1230.  
  1231.    Here, buffer is the pointer to the text to be inserted into the
  1232.    TInputLine.
  1233.  
  1234.    -------------------------------------------------------------
  1235.  
  1236.    Exit method (1)
  1237.  
  1238.    Version  Not specified
  1239.    Author   William Werth <billw@eskimo.com>
  1240.    Terms    TDialog; TButton
  1241.  
  1242.    //To exit a modal TDialog by pressing a
  1243.     //TButton hat does not send cmExit, cmQuit
  1244.    //or equivalent but sends cmSearch instead, and
  1245.    //to call another TDialog.
  1246.    TVDialog::TVDialog ()
  1247.      : TDialog (...), TWindowInit (...) {
  1248.      // other stuff
  1249.      insert (new TButton 
  1250.      (TRect(40,20,50,22), "~S~earch", cmSearch,
  1251.      bfDefault) );
  1252.      selectNext (False);
  1253.      };
  1254.    //There are two ways to do this
  1255.    //1) Overload the handleEvent function in TVDialog
  1256.    void TVDialog::handleEvent(TEvent& ev) {
  1257.       if (ev.what == evCommand &&
  1258.      ev.message.command == cmSearch) {
  1259.      clearEvent(ev);
  1260.      ev.message.comand = cmOk;
  1261.      // change event to one that will exit
  1262.      searchFlag = 1;
  1263.      // set a flag or somehow note cmSearch event 
  1264.      }
  1265.       TDialog::handleEvent(ev);
  1266.       }
  1267.    //2) Overload the handleEvent, but as follows:
  1268.    void TVDialog::handleEvent(TEvent& ev) {
  1269.       if (ev.what == evCommand &&
  1270.       ev.message.command == cmSearch) {
  1271.       endModal(ev.message.command);
  1272.       clearEvent(ev);
  1273.       }
  1274.       else
  1275.       TDialog::handleEvent(ev);
  1276.       }
  1277.  
  1278.    -------------------------------------------------------------
  1279.  
  1280.    Exit method (2)
  1281.  
  1282.    Version  Not specified
  1283.    Terms    TDialog
  1284.  
  1285.    This procedure does not use an OK or Cancel button to close the dialog
  1286.    because the specified action is accomplished before the dialog is
  1287.    closed.
  1288.  
  1289.    //  To trigger some action
  1290.    const ushort cmTVCommand = 100;
  1291.  
  1292.    void TVDialog::doSomething(void) {
  1293.    // Insert your tasks here;  messageBox() for
  1294.    // demonstration only
  1295.       messageBox("Doing something", mfInformation |
  1296.       mfOKButton);
  1297.       }
  1298.  
  1299.    // Virtual function:  if the event type is a command
  1300.    // which is yours and the dialog is valid
  1301.    void TVDialog::handleEvent(TEvent& event) {
  1302.         TEvent newEvent;
  1303.  
  1304.       if (event.what == evCommand &&
  1305.      event.message.command = cmTVCommand &&
  1306.      valid(cmOK)) {
  1307.      doSomething();
  1308.      clearEvent(event);
  1309.      newEvent.what = evCommand;
  1310.      newEvent.message.command = cmOK;
  1311.      newEvent.message.infoPtr = NULL;
  1312.      putEvent(newEvent);
  1313.      return;
  1314.      }
  1315.  
  1316.       TDialog::handleEvent(event);
  1317.       }
  1318.  
  1319.    Whether or not to put the newEvent event into the event queue
  1320.    could depend on the result from doSomething().
  1321.  
  1322.    Either way, the next time around you will have performed your
  1323.    tasks (which, by the way, cannot include posting another event
  1324.    -- only one can be posted at a time without processing the
  1325.    other) and handleEvent will get the cmOK command, and treat it
  1326.    normally.
  1327.  
  1328.    -------------------------------------------------------------
  1329.  
  1330.    Password Object (1)
  1331.  
  1332.    Version  TV2
  1333.    Author   Pat Reilly <71333.2764@compuserve.com>
  1334.    Terms    TDialog; TInputLine
  1335.  
  1336.    //Here is a simple password object and
  1337.     //implementation -
  1338.    class TPassword : public TInputLine {
  1339.    public:
  1340.       TPassword( const TRect& r, int aMaxLen,
  1341.       TValidator* aValid = 0 ) :
  1342.         TInputLine ( r, aMaxLen, aValid ) {}
  1343.       virtual void draw();
  1344.    };
  1345.    void TPassword::draw() {
  1346.       char* oldData = newStr(data);
  1347.       for ( char* p = data; *p != EOS; p++ )
  1348.      *p = '*';
  1349.       TInputLine::draw();
  1350.       strcpy( data, oldData );
  1351.       delete [] oldData;
  1352.    } 
  1353.    //...
  1354.   strcpy( data, oldData );
  1355.   delete [] oldData;
  1356.   // ...
  1357.   }
  1358.  
  1359.    -------------------------------------------------------------
  1360.  
  1361.    Password (2)
  1362.  
  1363.    Version  Not specified
  1364.    Terms    TDialog; TInputLine; TPasswordInput; TPasswordInput:: draw()
  1365.  
  1366.    To enter a password in a dialog box and to avoid having that password
  1367.    displayed can be achieved with the following code
  1368.  
  1369.    #define chrPassword '*'
  1370.  
  1371.    TPasswordInput::TPasswordInput( const TRect& bounds, int maxLen ) :
  1372.    TInputLine( bounds, maxLen), starData( new char[ maxLen] ) {
  1373.       memset( starData, chrPassword, maxLen);     // fill with stars
  1374.       *(starData+maxLen-1) = EOS;                 // end of line
  1375.       }
  1376.  
  1377.    TPasswordInput::~TPasswordInput() {
  1378.       delete [] starData; 
  1379.       }
  1380.  
  1381.    void TPasswordInput::draw( void) {
  1382.       char *origData;
  1383.       char *curEnd = starData + strlen( data);   // length of string
  1384.  
  1385.       *curEnd  = EOS;            // make '*'-string correct length
  1386.       origData = data;           // remember pointer;
  1387.       data     = starData;       // point to new data (all stars)
  1388.  
  1389.       TInputLine::draw();        // draw myself
  1390.  
  1391.       data     = origData;       // restore pointer
  1392.       *curEnd  = chrPassword;    // restore original '*'-string
  1393.       }
  1394.  
  1395.    -----------------------------------------------------------------------
  1396.  
  1397.    PALETTES
  1398.  
  1399.    Saving colours
  1400.  
  1401.    Version  Not specified
  1402.    Terms    TPalette; fpstream; fpstream::readBytes; fpstream::writeBytes;
  1403.         opstream
  1404.  
  1405.    // Here's how to save the colors.
  1406.    void TVApp::saveColors(void) {
  1407.       fpstream *f = new fpstream("ANYFILE", ios::trunc |
  1408.       ios::binary);
  1409.  
  1410.       opstream &strm = *f;
  1411.  
  1412.       // Store the palettes
  1413.       short curr_palette = appPalette;
  1414.       for(short i = 0; i < 3; i++) {
  1415.      appPalette = i;
  1416.      TPalette *palette = &getPalette();
  1417.      strm.writeBytes(palette->data, palette->data[0] + 1);
  1418.      }
  1419.      appPalette = curr_palette;
  1420.       }
  1421.  
  1422.    // Here's how to load the colors.
  1423.    void TVApp::loadColors(void) {
  1424.      fpstream *f = new fpstream("ANYFILE", ios::in |
  1425.      ios::nocreate | ios::binary);
  1426.      ipstream &strm = *f;
  1427.  
  1428.      // Read palettes from the configuration file.
  1429.      short curr_palette = appPalette;
  1430.      for(short i = 0; i < apTotalPalettes; i++) {
  1431.     appPalette = i;
  1432.     TPalette *palette = &getPalettes();
  1433.     strm.readBytes(palette->data, palette->data[0] + 1);
  1434.     }
  1435.    appPalette = curr_palette;
  1436.    }
  1437.  
  1438.    -----------------------------------------------------------------------
  1439.  
  1440.    COLLECTIONS AND RESOURCE FILES
  1441.  
  1442.    TListBox and arrays
  1443.  
  1444.    Version  None specified
  1445.    Terms    TListBox; TNSCollection::insert; ::newStr; arrays
  1446.  
  1447.    // From file:
  1448.    FILE *f;
  1449.    char buf[80];
  1450.    int n, cnt=0;
  1451.    while (fgets(buf,80,f))
  1452.    // could use strdup()?
  1453.    collection->insert(newStr(buf));
  1454.  
  1455.    while (fread(&n,2,1,f)) {
  1456.      sprintf(buf,"Counter %u = %u",cnt++,n);
  1457.      collection->insert(newStr(buf)); 
  1458.      }
  1459.    // From array is similar
  1460.  
  1461.    Comment: There may be difficulty reading streamable file from other
  1462.    language programs.
  1463.  
  1464.    ====================== END OF TEXT PART 2 =============================
  1465. -- 
  1466. Rachel Polanskis             grove@zeta.org.au            Robert Hazeltine  
  1467.                  http://www.zeta.org.au/~grove/grove.html
  1468.                        r.polanskis@nepean.uws.edu.au
  1469. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1470.