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

window bug?

I have been getting strange behavior with some dialog boxes and wonder
whether it is a bug or just my ignorance.  The code is given below.

I have a function "show-it" that
puts up a dialog box with some static text and then pauses 2 seconds.
(The dialog box does not close.)
When I type in  (show-it)  the dialog box appears as expected.
So far, so good.

But I also created a function "test" that puts up another dialog box
containing a single button.  If you click in this button, it
calls my function "show-it."  However, when you do this,
the show-it dialog box appears, but it waits 2 seconds before
displaying the static text!  It's as if the last two lines
of the show-it function get reversed.

It seems that the problem has to do with the static text getting
associated with the wrong port.  Can anyone explain this behavior
to me and tell me how to avoid it?

(defun test ()
  (make-instance 'window
    :window-type :document :view-size #@(129 57) 
    :view-subviews (list
       (make-dialog-item 'button-dialog-item
	 #@(13 16) #@(88 18)  "Show it"
	 #'(lambda (item)
	     (declare (ignore item))

(defun show-it ()
  (let ((the-dialog (make-instance 'dialog
           :window-type :double-edge-box
	   :view-position '(:top 60)
	   :view-size #@(202 34)
	   :view-subviews (list
	      (make-dialog-item 'static-text-dialog-item
	 	#@(3 1) #@(293 16) "" nil
		:view-nick-name 'text)))))
	(set-dialog-item-text (view-named 'text the-dialog)
		"Here's the text.")
	(sleep 2)))