[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can anyone help me understand window updates? (repeat)
- To: osiris@cs.utexas.edu (Rob Browning), info-mcl@cambridge.apple.com
- Subject: Re: Can anyone help me understand window updates? (repeat)
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Mon, 27 Jun 1994 11:35:47 -0500
At 10:04 PM 6/26/94 -0500, Rob Browning wrote:
>I sent this to comp.lang.lisp.mcl, but no one responded, so I thought I'd
>try here.
>
>Subject: Can anyone help me understand window updates?
>From: Rob Browning, osiris@cs.utexas.edu
>Date: 21 Jun 1994 23:36:30 GMT
>In article <2u7thu$9j7@geraldo.cc.utexas.edu> Rob Browning,
>osiris@cs.utexas.edu writes:
>>
>>I was trying to set up a window that had a vertical scrollbar. (Yes I
>>know about the scroller code, but I want one that updates the contents of
>>the window _after_ it draws the scroll bar, because updates take a while.)
>>
>>When I try to do this in the naive way, the code that I use to draw the
>>window overwrites the scroll bar and grow box. This is because when
>>view-draw contents is called, the clip region is set to the entire window.
>>
>>I only wanted to make the clip region a little smaller to exclude the
>>scroll bar before I start drawing. However, I cannot seem to accomplish
>>this. My first try was to call validate-corners on the bounding
>>rectangle
>>of the scroll bar before I started drawing like this
>>
>>(defmethod view-draw-contents ((win rt-win....))
>>
>> (multiple-value-bind (scroll-tl scroll-br)
>> (view-corners (rt-win-scroller win))
>> (validate-corners win scroll-tl scroll-br)
>> ...draw...
>> ...))
>>
>>However, this does not work. I assume because the validate-corners only
>>has an effect on the next call to view-draw-contents.
Validate corners calls #_ValidRgn and changes the window-erase-region
and window-invalid-region, which MCL uses to determine what to erase
when an update event happens.
>>
>>So I tried clip-rect:
>>
>>(defmethod view-draw-contents ((win rt-win....))
>>
>> (multiple-value-bind (scroll-tl scroll-br)
>> (view-corners (rt-win-scroller win))
>> (clip-rect win scroll-tl scroll-br)
>> ...draw...
>> ...))
>>
>>But this does not work either. In fact I found that clip-rect does
>>nothing for the higher level quickdraw commands like line, frame-oval,
>>etc. Why?
It appears that you're clipping to the scroll bar. Was that your intention?
I though you'd want to clip to the window excluding the scroll bar
>>
>>So, my ultimate question is, once you are inside your view-draw-contents
>>method, is there any way to affect the clip region for the window so that
>>subsequent higher level quickdraw calls like (frame-oval win 0 0 200 200)
>>will be affected?
As long as focus-view is never called after your call of clip-rect,
everything should be OK. If you focus on another view (with-focused-view),
refocusing on the window will destroy your clip-rect work.
MCL's view system isn't designed to make it easy to change the
clip region of a window. You can do so by using undocumented internals,
but you'd be better off to design your window with two non-overlapping
subviews: a drawing view and the scroll bar view. Then you won't run
into these problems at all.