[comp.lang.pascal] A neat little problem in TV.

nmouawad@watmath.waterloo.edu (Naji Mouawad) (06/07/91)

Here is a neat little problem in Turbo Vision. I suspect that it
applies to Turbo Pascal -Windows.

Suppose that a Dialog box owns a button called "View" and two
FileLists L1 and L2. A FileList is List viewer which nows that it has
a collection of file lists.

Here is the picture:

+-[]-------------------Dialog Box---------------------+
|                                    [ View  ]        |
|                                                     |
|    ........List 1.......   ........List 2.......    |
|    .                   .   .                   .    |
|    .                   .   .                   .    |
|    .                   .   .                   .    |
|    .                   .   .                   .    |
|    .                   .   .                   .    |
|    .                   .   .                   .    |
|    .                   .   .                   .    |
|    .....................   .....................    |
|                                                     |
+-----------------------------------------------------+

List1 and List2 are simple list viewers with no frames and
View is a simple button. Nothing complicated.

Here is the problem: suppose that L1 is active. Suppose that
file "foo.pas" is focused in L1 and file "blah.pas" is focused
in L2.

Given that L1 is active, the user presses on the View button, wishing
to see the file "foo.pas".

But when the event handler of the dialog box gets this command,
L1 is no longer active ! That is L1 and L2 are in the same
state ! Which file should the Event Handler pass onto the file
viewer, "foo.pas" or "blah.pas" ?

What would you do in such a case ? Observe that TypeOf is of
no help here since L1 and L2 are of the same type.

Could you suggest an elegant solution to this problem ?

--Naji.

            
-- 
     -------------------------------------------------------------------
    | Naji Mouawad  |          nmouawad@watmath.waterloo.edu            |
    |  University   |---------------------------------------------------|
    | Of Waterloo   |   "The Stranger in us is our most familiar Self"  |