Professional Web Applications Themes

ScrollView and drawRect - Mac Programming

The view is made with Interface Builder as Custom View and the scrollview is build with the "Layout -> Make subview of -> Scroll View" menu The view hold some text and graphics all done in drawRect method. Each time a scroll is needed (mouse click in arrow) drawRect is called. But there is no need to redraw anything since there is nothing new (text or graphics) in the custom view. Every text and graphics was already made in the custom view by the previous drawRect call, even the ones that not covered by the scroll rectangle. If I force ...

  1. #1

    Default ScrollView and drawRect

    The view is made with Interface Builder as Custom View and
    the scrollview is build with the "Layout -> Make subview of -> Scroll View" menu

    The view hold some text and graphics all done in drawRect method.

    Each time a scroll is needed (mouse click in arrow) drawRect is called.
    But there is no need to redraw anything since there is nothing new (text
    or graphics)
    in the custom view. Every text and graphics was already made in the custom view
    by the previous drawRect call, even the ones that not covered by the
    scroll rectangle.

    If I force drawRect to do nothing when a mouse click in lower arrow
    happen, an empty rectangle
    appear at the bottom of the view rectangle.

    Is there any way to rebuild text and graphics only when some change
    was made in these text and graphics ?

    My scrolling is too slow because drawRect must compute each time
    a large rectangle of text and graphics. How to do this work only one time
    and just show other part of the text and graphics rectangle when scrolling
    happen ?
    Alain Birtz Guest

  2. #2

    Default Re: ScrollView and drawRect

    In <abz-1209030929190001192.168.1.3> Alain Birtz wrote:
    > The view is made with Interface Builder as Custom View and
    > the scrollview is build with the "Layout -> Make subview of -> Scroll
    > View" menu
    >
    > The view hold some text and graphics all done in drawRect method.
    >
    > Each time a scroll is needed (mouse click in arrow) drawRect is called.
    > But there is no need to redraw anything since there is nothing new (
    > text or graphics) in the custom view. Every text and graphics was
    > already made in the custom view by the previous drawRect call, even
    > the ones that not covered by the scroll rectangle.
    >
    > If I force drawRect to do nothing when a mouse click in lower arrow
    > happen, an empty rectangle
    > appear at the bottom of the view rectangle.
    >
    > Is there any way to rebuild text and graphics only when some change
    > was made in these text and graphics ?
    >
    > My scrolling is too slow because drawRect must compute each time
    > a large rectangle of text and graphics. How to do this work only one
    > time and just show other part of the text and graphics rectangle when
    > scrolling happen ?
    Store the drawn computed "large rectange of text and graphics" in an
    NSImage. Now when drawRect is called, just grab the correct part of that
    image. Also make sure drawsBackground is set to YES. m.


    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

Similar Threads

  1. Problems using unscaledWidth and drawRect inupdateDisplayList
    By zanedev in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 9th, 12:46 AM
  2. (the stage). & 'rect','drawRect'?????
    By BigDaddy webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 3
    Last Post: October 23rd, 05:44 PM
  3. the stage.drawrect
    By Gary in forum Macromedia Director Lingo
    Replies: 12
    Last Post: October 14th, 01:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139