[comp.sys.next] View question

combs@sumex-aim.stanford.edu (Dave Combs) (08/08/89)

Gang,
Does anyone know of a simple way to change the order of display of views
and their subviews?  I'm trying to develop a class that will implement the
"knobbies", dragging and resizing options of the standard Draw application
(extended for my own use).  As of now, I'm assuming that this new
ResizableItem class is a subclass of View, and that it contains a
subclass of View as its item to be drawn (note: the Draw app uses subclasses
of Object, and implements its own draw and selection operations).
However, if I let the standard display operation do the drawing by
calling drawSelf::, my new class (which will draw the knobbies) gets drawn
first, then overlaid by the subviews that it is supposed to be highlighting.

The point of doing all this is to try and use the standard view-subview
hierarchy (since it already exists) to do something that the Draw application
does now, without having to simulate all of Draw's changing of frame and
bounds.

Any help on this is GREATLY appreciated,
Dave  (combs@sumex-aim.stanford.edu)

jpd00964@uxa.cso.uiuc.edu (08/11/89)

> Does anyone know of a simple way to change the order of display of views
> and their subviews?

The first subviews added get drawn first, with later ones getting put on
top of them.  You could pull them out of the list and put them back in again.

However, from you posting, if I understand correctly, I think you might find
it easier to add the "knobbies" as a subview of you rectangles instead of
the other way around.  Either that, or include a flag in each rectangle object
on if it should have knobbies or not.  Then, in its drawSelf:: routine, you
could draw the knobs if the flag is set and not draw them if its not.

Michael Rutman
Softmed