From: ppollet@cismibm.univ-lyon1.fr (Patrick POLLET)
Newsgroups: comp.lang.pascal
Subject: Re: TurboVision Question (w/ example)
Date: Thu, 21 Jan 1993 08:02:52 GMT
Organization: INSA  CENTRE INFORMATIQUE DU 1er CYCLE
NNTP-Posting-Host: pc110-02.insa-lyon.fr

In article <1993Jan20.183755.19926@ncsu.edu> samodena@csemail.cropsci.ncsu.edu (S. A. Modena) writes:
>From: samodena@csemail.cropsci.ncsu.edu (S. A. Modena)
>Subject: Re: TurboVision Question (w/ example)
>Date: Wed, 20 Jan 1993 18:37:55 GMT

>In article <ppollet.156.727460280@cismibm.univ-lyon1.fr> ppollet@cismibm.univ-lyon1.fr (Patrick POLLET) writes:

>Concerning this part of what Patrick says:

>>              MyDialog^.SetData(Params);
>>              Desktop^.ExecView(MyDialog);
>>              .......
>>            end     
>>
>>    CAUTION : Since you are executing the Dialog by ExecView, The 
>>application is "put in the background" until the dialog is closed!
>>So there is no way for the appliaction to update the content of the 
>>paramtext while the dialog is ON SCREEN ....It could be done by the
>>dialog itself in its method HandleEvent, provided it "knows" the 
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>identifiers of the variables that hold the actual data... 


>Unfortunately, this is misleadingly incorrect.....Patrick has read
>the TV book and misinterpretted it.  :^)

[ Stuff deleted ]

.......

>For example, in one of my applications, I pop a dialog box to look at
>a dataset (a TSortedCollection of records).  One of the buttons in the
>dialog box is labelled "Master": it pops a master list dialog of fill-in
>values suitable for insertion into my dataset.  So I click on the
>"Master" button, an overlapping dialog box pops and my first dialog
>box (now partially visible) "freezes."  I double click on a item in a listbox
>and it is MESSAGEs the selection to the overlapped database dialog, which 
>creates a
>new record with it, inserts it into the TSortedCollection, redraws the
>list box to show the newly inserted record, updates and redraws a
>a record count static text....all this visible action in a "suspended,"
>non-modal dialog box in "background."

>This is known as "event-driven" programming.  Objects talk to each other!

>A different route to take for background processes, is to hook onto
>TApplication.Idle and feed broadcast messages to the DeskTop which
>will route them to all inserted views (not just the modal view) for
>processing and responsive actions.


>Steve

    That's exactly what I said... ( by the Dialog itself in its 
     method handleEvent() !!!!!!
 
    In your two examples you had to program response to events in the 
ON SCREEN dialogs for it to react  to focused events:
     -when you clicks on the button MASTER, of the First Dialog .  
     -when you double click on an item of the overlapping Dialog.   

   And also you had to adapt the handleevent() methods in the 
other dialogs when they received notification that something has changed 
elsewhere.

   Whether it is a broadcast or a focused event makes no difference.

   It is the ON SCREEN dialog that detect any modification to some 
   Data and requests all others to update.... 

   Even if you do it at the application Idle level, you still have to
   program something like:

      If the NewValue of some data has changed 
           send an updating event to Desktop to forward it 
           Update the New value  

      This is not really clean programming since the DATA must be global
   and in two occurences (one for the Oldvalue and one for the NewValue...)
   So objects do talk to each others but also uses some global data 
   in common....

  In real OOP languages (Frame languages such as Shirka,KL-1,Yafool..) 
objects uses REFLEX-methods  that sense any modification of their 
environnement  and reacts   WITHOUT the need for the object responsible of 
the modification to  signal in some way that something has happened.
  But TP is not a real OOP language by an hybrid language.

      OOP do give some real powerful tools to programmer, but one 
should keep in mind the BASIC concepts of modular programming:
    -the minimal amount of global data
    -the mimimal interdependance of modules (whether objects or simple
       procedures) to each other.
    -no object should have a direct reference to another one 

     
 
    
ppollet@cismibm.univ-lyon1.fr (Patrick POLLET)
--------------------------------------------------------
Dr Patrick L.Pollet
Institut National des Sciences Appliquees
Centre Informatique du 1er Cycle  Bat 110
20 Avenue A.Einstein
69621 Villeurbanne Cedex France
--------------------------------------------------------
Phone: 72 43 83 80 -   la premiere erreur c'est
Fax  : 72 43 85 33 -   de se lever le matin  ... GASTON
-------------------------------------------------------