[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ccl::draw-outline



>>In my application, I turned the outline of an editable-text-dialog-item on and off according  
>>to some event.
>>[...]
>Since the outline is not within the bounds of (view-corners ) [ugh!] you
>will probably need to erase a suitable rectangle after setting the slot
>value and before calling view-focus-and-draw-contents.
>
>If this causes too much flash, you can use a region which is the difference
>of a suitable rectangle and view-corners...

The problem is not that VIEW-CORNERS returns the wrong values.
The problem is that you're calling it after setting the ccl::draw-outline
slot to NIL. The following method does the right thing. If you find it too
flashy, I can make a version that flashes less (but you try it first, please):

(defmethod set-draw-outline ((e ccl::basic-editable-text-dialog-item)
                             new-outline)
  (let ((new-outline (not (null new-outline)))
        (old-outline (not (null (slot-value e 'ccl::draw-outline)))))
    (unless (eq old-outline new-outline)
      (without-interrupts
       (when old-outline
         (invalidate-view e t))         ; erase the outline
       (setf (slot-value e 'ccl::draw-outline) new-outline)
       (when old-outline
         (validate-view e))             ; don't erase the text
       (invalidate-view e)))            ; redraw. This flashes a little.
    new-outline))