[comp.lang.pascal] Turbo Vision, TListViewer

slkww@cc.usu.edu (02/28/91)

I'm trying to learn Turbo Vision.  As an exercise, I'm using TListViewer
to view a directory list inside a window, and I have two problems:

- the color for the filenames is flashing white on red, as is the
  color for the selected item.  I've done nothing to change the 
  default palette; even if I wanted to, to book leaves me clueless.
  Do I have to activate the palette somehow?

- even though the book states that TListViewer's Draw method "copes
  with resizing," my directory list view does not change size with
  the window.  What does the book's statement mean?

Any comments would be greatly appreciated.

Turbo Vision seems to me to be either overly complicated or underly
documented.  I sure would like to see a comp.lang.pascal.tvision group
soon.


Ken Austin    slkww@cc.usu.edu

fehr@ms.uky.edu (Jeffrey Davis) (03/04/91)

In article <1991Feb27.230255.46955@cc.usu.edu> slkww@cc.usu.edu writes:
>
>Turbo Vision seems to me to be either overly complicated or underly
>documented.  I sure would like to see a comp.lang.pascal.tvision group
>soon.
I agree. Since I am about to embark on a significant port of a couple 
of large programs, and I'd like to use TurboVision, I'm sure I could
add my share of questions.


-- 
davis@ca.uky.edu 

rind@popvax.uucp (747707@d.rind) (03/04/91)

[Question about TListViewer deleted.]

As far as I can tell, despite some statements in the TV manual that seem
to imply otherwise, TListViewers are only meant to be placed in TDialog
boxes and not in TWindows.  If you put it in a Dialog then the colors
come out right and everything seems to work.  If people have found
another solution, I'd be interested.

David Rind
rind@popvax.harvard.edu

bobb@vice.ICO.TEK.COM (Bob Beauchaine) (03/05/91)

>In article <1991Feb27.230255.46955@cc.usu.edu> slkww@cc.usu.edu writes:
>>
>>Turbo Vision seems to me to be either overly complicated or underly
>>documented.  I sure would like to see a comp.lang.pascal.tvision group
>>soon.

  As a card carrying Windows hater, I too will probably develop 
  applications in Turbo Vision well into the immediate future.
  Sounds like it's time to have a vote on creation of a new
  newsgroup.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 

Bob Beauchaine bobb@vice.ICO.TEK.COM 

C: The language that combines the power of assembly language with the 
   flexibility of assembly language.

seth@wet.UUCP (Seth Olitzky) (03/08/91)

In article <1991Feb27.230255.46955@cc.usu.edu> slkww@cc.usu.edu writes:
>I'm trying to learn Turbo Vision.  As an exercise, I'm using TListViewer
>to view a directory list inside a window, and I have two problems:
>
>- the color for the filenames is flashing white on red, as is the
>  color for the selected item.  I've done nothing to change the 
>  default palette; even if I wanted to, to book leaves me clueless.
>  Do I have to activate the palette somehow?
>- even though the book states that TListViewer's Draw method "copes
>  with resizing," my directory list view does not change size with
>  the window.  What does the book's statement mean?

Turbo Vision has a somewhat sharp learning curve, but once over the hurdle
its great.

1. You have used TListViewer on a TWindow, not on a TDialog.  This causes
the palette to be wrong.  Certain items in Turbo Vision, buttons, list boxes,
are designed to be inserted onto dialog boxes and not windows.  The palette
for a default TWindow is not large enough to handle these objects.  Compare
the palettes for TDialog and TWindow.  See the difference.

Flashing white on Red always means that you have a bad GetColor call
and that the palette indexes could not be followed up to the application.

2. Don't use TListViewer.  Its not made to be on a resized window.
   Use TSCROLLER.  This works like a champ and all that you have to write
   is the Draw procedure.  But you can find an example for all of this in
   the Turbo Vision book on around page 40 and upwards.  Read it.

Im also looking for other Turbo Vision crazies, besides myself.  What the
use of learning it all if I can't discuss it with someone.


-- 
-----------------------------------------------------------------------------
Seth Olitzky             seth@wet
         ...!sun!hoptoad!wet!seth
----------------------------------------------------------------------------

kankkune@cs.Helsinki.FI (Risto Kankkunen) (03/14/91)

>2. Don't use TListViewer.  Its not made to be on a resized window.

Have you set the GrowMode correctly (gfGrowHiX+gfGrowHiY, for example)?
I have had no problems with TListBox. I don't remember where in the
hierarchy TListViewer is, but I think it should work, too.

 Risto Kankkunen                   kankkune@cs.Helsinki.FI (Internet)
 Department of Computer Science    kankkunen@finuh          (Bitnet)
 University of Helsinki, Finland   ..!mcsun!uhecs!kankkune   (UUCP)

kankkune@cs.Helsinki.FI (Risto Kankkunen) (03/14/91)

>As far as I can tell, despite some statements in the TV manual that seem
>to imply otherwise, TListViewers are only meant to be placed in TDialog
>boxes and not in TWindows.

This is what I dislike most of in TV. Though, I understand the design
principles, but I think I had made the palette system differently.

> If people have found another solution, I'd be interested.

There is, however, a work-around. You have to override the view's
GetPalette method. The standard palette references entries that are not
in TWindow's palette, as it is smaller than that of TDialog. You can do
something like this:

FUNCTION GetPalette:PString;
CONST
  Colours   =#7#8#7#8#1 etc. choose suitable indexes from TWindow's palette
  MyPalette :String[Length(Colours)]=Colours;
BEGIN
  Getpalette:=@MyPalette;
END;

 Risto Kankkunen                   kankkune@cs.Helsinki.FI (Internet)
 Department of Computer Science    kankkunen@finuh          (Bitnet)
 University of Helsinki, Finland   ..!mcsun!uhecs!kankkune   (UUCP)