GraphicsCcontext and bounds - screenshot.gif (0/1) 
Author Message
 GraphicsCcontext and bounds - screenshot.gif (0/1)

Hi All

I need to display some elements in editor window. Elements and their
wrappers are contained in CompositePart. Now, I have tried to display
border around each element, so I modified displyOn: method of wrappers
(I have my own wrapper class and I have to avoid to use
BorderedWrapper).

The inciminated method follows: (DocumentElementWrapper is subclass of
TranslatingWrapper).
DocumentElementWrapper>>displayOn: aGraphicsContext
        | pl |
        super displayOn: aGraphicsContext.

        aGraphicsContext paint: ColorValue red.
        pl := Polyline fromRectangle: self bounds.
        pl displayStrokedOn: aGraphicsContext.

        aGraphicsContext paint: ColorValue blue.
        pl := Polyline fromRectangle: self preferredBounds.
        pl displayStrokedOn: aGraphicsContext.

Result is in attached image.

Can some explain this behavior? And can some give me short
introduction to concept of bounds and preferredBounds? (My own view
based on reading methods and class comment leads in thins broken
result).

Thank a lot
        Petr Bouda



Tue, 01 Feb 2005 15:10:48 GMT  
 GraphicsCcontext and bounds - screenshot.gif (0/1)
Petr,

Quote:
>Can some explain this behavior? And can some give me short
>introduction to concept of bounds and preferredBounds? (My own view
>based on reading methods and class comment leads in thins broken
>result).

The basic difference between bounds and preferredBounds is that bounds is the
visible bounds of the view, while preferredBounds is the size of the actual
object being displayed. Thus, in a text, image, or list when the size of the
elements being displayed is larger than the box it displays in (i.e. when
scrollbars are in use), then the preferredBounds will be bigger than the bounds.

However, what you are seeing is something more. The only place where bounds or
preferredBounds tend to make any real sense is when you ask the view. The
various wrappers and composites translate these values adding or subtracting or
combining values.

My suggestion, although not having the whole thing in front of me, I'm just
guessing, is to ask the "visual" elements for their bounds, and use those as
your drawing basis.

                                And So It Goes
                                     Sames
______________________________________________________________________

Samuel S. Shuster [|]
VisualWorks Engineering, GUI Project
Go Smalltalk!



Tue, 01 Feb 2005 23:53:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Explicit interface of a type-bound procedure bounded to an instance (F2003)

2. Silly Screenshot Capture Question

3. How to take a screenshot from REALbasic?

4. Windows API for screenshot

5. LogFlash & IMPEX - new screenshot pages

6. get an IE 5 screenshot

7. high-resolution RDE screenshot needed

8. fyi: screenshot of jEdit used to code Ada

9. Screenshot again

10. Screenshot in Tkinter

11. Coolest Tk Screenshot Contest: Win ActiveTcl Pro Studio!

12. ActiveState contest: Coolest Tk Screenshot

 

 
Powered by phpBB® Forum Software