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

Modal weirdness



I have a sneaking suspicion that this may be an FAQ, but I'll ask anyway
('cos that's the kind of guy I am).

There seems to be a glitch in 'modal-dialog' in MCL 2.0. If 'window-close'
is called within a call to 'modal-dialog', 'modal-dialog' closes the modal
window and returns :closed ... even if 'window-close' was actually called
on a completely different window! Here's some code to demonstrate that ...

(modal-dialog
   (make-instance 'window
     :window-title "Modal Window"
     :view-subviews (list 
                     (make-instance 'button-dialog-item
                      :dialog-item-text "Click me"
                      :dialog-item-action #'(lambda (Button)
                                             (declare (ignore Button))
                                             (let ((SubWindow
                                                    (make-instance 'window
                                                     :view-position #@(100
100)
                                                     :window-title
"SubWindow")))
                                              (sleep 1)
                                              (window-close
SubWindow)))))))

When 'window-close' is called on the subwindow that is opened in response
to the button press, the modal window from which it was launched goes away,
and ':closed' is returned, but the subwindow stays open. This, to put it
mildly, is not exactly what I expected, and is something of an
inconvenience.

It's probably no more than I deserve for stacking modal windows, but there
are cases when it would be nice to be able to do something like this ...

Any workarounds? Suggestions?

                                 A

x--------------------------------------------------------------------x
| Angus McIntyre    angus@aegypt.demon.co.uk    angus@arti.vub.ac.be |
|--------------------------------------------------------------------|
|   "I am here by the will of the people ... and I will not leave    |
|    until I get my raincoat back." ['Metrophage', Richard Kadrey]   |
x--------------------------------------------------------------------x