[comp.lang.pascal] How do I cascade new window?

enzerinkp@topaz.ucq.edu.au (Peter Enzerink, UCCQ, Australia.) (05/18/91)

I'm driving myself crazy with this problem, and I'm sure the solution is really
simple. I just can't work it out.

I want to open a new window on the desktop with a size slightly smaller than
the topmost window. ie. It won't overwrite the previous window. I can't for the
life of me figure out what I'm doing. I've looked at the code in APP.PAS where
they cascade the desktop, but I can't seem to get anything relevant out of it.

Any help, greatly appreciated.

Regards Peter
-- 
                    "Binary rules - 01001111 01001011"
^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
Peter Enzerink          3rd year Student, Bachelor Applied Science (Computing) 
DAAC Rep. (Computing)                 University College of Central Queensland
                                                   Rockhampton 4702, Australia
Internet: ENZERINP@JASPER.UCQ.EDU.AU                     Phone: +61 079 222815

nmouawad@watmath.waterloo.edu (Naji Mouawad) (05/21/91)

In article <1991May18.121506.7254@topaz.ucq.edu.au> enzerinkp@topaz.ucq.edu.au (Peter Enzerink, UCCQ, Australia.) writes:
>I'm driving myself crazy with this problem, and I'm sure the solution is really
>simple. I just can't work it out.
>
>I want to open a new window on the desktop with a size slightly smaller than
>the topmost window. ie. It won't overwrite the previous window. I can't for the
>life of me figure out what I'm doing. I've looked at the code in APP.PAS where
>they cascade the desktop, but I can't seem to get anything relevant out of it.
>
>Any help, greatly appreciated.
>
>Regards Peter
>-- 

Hello Peter,

  What you want to do is not extremely hard but it is not straightforward
either:

  I will assume that the top most window and the new window to be
drawn belong to the same group. If not, the basic operations I am about
to describe will work with a little change.

  First of all, the top most window is the active window, within which
lives the focused view. That is if your top most window is a file
viewer most probably it ownes a frame, one or two scroll bars, and
a Tscroller, which is the focused view.

 Now, in order to open a window on top of the active window you need to:

  1) find the active window within the current modal view
  2) Get its x,y,size
  3) Get its relative coordinates with respect to its owner
  4) update the size and relative coordinates of your new window,
  5) insert it, or redraw it if it was already inserted.

 At this point, the new window becomes the active window.

 Finally, note that care must be taken when the active view is zoomed
 to its smallest possible size. In which case you may not be able to
 draw your new window without covering the active window.

 In order to perform these five steps, I suggest you refer to the
TV manual. Each one of them is explained there. You will need to wander
around a little bit as the TV manual is not highly modular. Should you
have any problem, either re-post or e-mail and I'll try to help.

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