Re: Detecting a resize

So, this is how you can do this trick with the timer event in mzgtk2:

Given the object variables _redraw, _sa-w and _sa-h and the function
_last-zoom, which does the proper zooming depending on the last type
of zooming (zoom 100%, zoom to fit, etc.):

   (define (handle-size-allocation widget x y w h)
     (set! _redraw (+ _redraw 1))
     (if (> _redraw 10000) (set! _redraw 0))
     (if (not (and (= _sa-w w) (= _sa-h h)))
         (let ((r _redraw))
           (mzgtk2-timer-add 500 (lambda ()
                                   (if (= _redraw r) (_last-zoom))
                                   (set! _sa-w w)
                                   (set! _sa-h h)

It's that simple.


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