[graphic-forms-devel] Problems with dialogs

Ken Perry whistler at blinksoft.com
Mon Sep 10 20:04:56 UTC 2007


Since I was having trouble with the layouts looking right I decided to try
to make the program with out a layout mangier.  If you run this and maximize
the dialog you will see that it all lies up now.  Now I am having a
different problem though it seems with out the layout mangier I lose the
default buttons.  I have the btn-add set to be the default button but when I
hit enter on the edit box it gives me a warning and does nothing.  Did I do
the default button correctly?  The following is the running code:


(defclass fruit-events (gfw:event-dispatcher) ())

(defmethod gfw:event-close ((disp fruit-events) (dlg gfw:dialog))
(call-next-method)
(let ((ownerp (gfw:owner dlg)))
(gfs:dispose dlg)
(unless ownerp
(gfw:shutdown 0))))
		
(defun fruit-basket-nl ()
(gfw:startup "Fruit basket" (lambda ()
 (let* ((dlg (make-instance 'gfw:dialog :owner nil
:dispatcher (make-instance 'fruit-events)
:style :modeless
:text "Fruit basket LISP demonstration"))
(fruit-list (make-instance 'gfw:list-box
;:callback (fruit-list-callback)
:parent dlg))
(fruit-label (make-instance 'gfw:label
:text "Enter fruit:"
:parent dlg))
(fruit-edit (make-instance 'gfw:edit
:text 		""
:parent dlg))
(btn-add (make-instance 'gfw:button
:style '(:default-button)
:callback (lambda (disp btn )
(declare (ignore disp btn))
(gfw:append-item fruit-list (gfw:text fruit-edit ) nil nil)        	
(setf (gfw:text  fruit-edit) "")                    	
(gfw:give-focus fruit-edit))                           	
:style '(:default-button)
:text "Add"
:parent dlg))
(btn-remove (make-instance 'gfw:button
:callback (lambda (disp btn)
(declare (ignore disp btn))
(gfw:delete-selection  fruit-list)
(gfw:give-focus fruit-edit))
:style '(:default-button)
:text "Remove"
:parent dlg))
(btn-exit (make-instance 'gfw:button
:callback (lambda (disp btn)
(declare (ignore disp btn))
(let ((ownerp (gfw:owner dlg)))
(gfs:dispose dlg)
(unless ownerp
(gfw:shutdown 0))))
:style '(:cancel-button)
:text "Exit"
:parent dlg)))


	(declare (ignore fruit-label btn-add btn-remove btn-exit))
	    (setf (gfw:minimum-size dlg) (gfs:make-size :width 186 :height
141 ))
			    (setf (gfw:location  fruit-label)
(gfs:make-point :x 6 :y 6 ))
					    (setf (gfw:size fruit-label)
(gfs:make-size :width 50 :height 23 ))
			    (setf (gfw:location  fruit-edit) (gfs:make-point
:x 60 :y 6 ))
					    (setf (gfw:size fruit-edit)
(gfs:make-size :width 120 :height 23 ))
			    (setf (gfw:location  fruit-list) (gfs:make-point
:x 33 :y 33 ))
					    (setf (gfw:size fruit-list)
(gfs:make-size :width 120  :height 77 ))
			    (setf (gfw:location  btn-add) (gfs:make-point :x
6 :y 114 ))
					    (setf (gfw:size btn-add)
(gfs:make-size :width 55  :height 23 ))
			    (setf (gfw:location  btn-remove) (gfs:make-point
:x 65 :y 114 ))
					    (setf (gfw:size btn-remove)
(gfs:make-size :width 56  :height 23 ))
			    (setf (gfw:location  btn-exit) (gfs:make-point
:x 125 :y 114 ))
					    (setf (gfw:size btn-exit)
(gfs:make-size :width 55  :height 23 ))
(setf (gfw:default-widget dlg) btn-add)

(gfw:show dlg t)
dlg))))




More information about the Graphic-forms-devel mailing list