[graphic-forms-devel] List box not resizing.
Ken Perry
kperry at blinksoft.com
Fri Sep 7 06:24:10 UTC 2007
Sorry the previous one I sent had a small error I didn't have the inner
layout manager with the correct parent so here it is again:
(in-package #:graphic-forms.uitoolkit.tests)
(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 move-txt-content (txt lb)
(gfw:append-item lb (truncate-text (gfw:text txt )) nil nil)
(setf (gfw:text txt) "")
(gfw:give-focus txt))
(defun remove-item ( lb txt )
(gfw:delete-selection lb)
(gfw:give-focus txt))
;
(defun fruit-dlg (title style parent)
(let* ((dlg (make-instance 'gfw:dialog :owner parent
:dispatcher (make-instance 'fruit-events)
:layout (make-instance 'gfw:flow-layout
:margins 8
:spacing 8
:style '(:vertical))
:style style
:text title))
(edit-disp (make-instance 'edit-control-events))
(top-panel (make-instance 'gfw:panel
:layout (make-instance 'gfw:flow-layout
:spacing 4
:style '(:vertical))
:parent dlg))
(inner-panel (make-instance 'gfw:panel
:layout (make-instance 'gfw:flow-layout
:spacing 4
:style '(:horizontal))
:parent top-panel))
(fruit-label (make-instance 'gfw:label
:text "Fruit:"
:parent inner-panel))
(fruit-edit (make-instance 'gfw:edit
:text "fffffffffffffffffffffffffffffff"
:parent inner-panel))
(fruit-list (make-instance 'gfw:list-box
; :callback
(fruit-list-callback)
:parent top-panel))
(btn-panel (make-instance 'gfw:panel
:layout (make-instance 'gfw:flow-layout
:spacing 4
:style '(:horizontal :normalize))
:parent dlg))
(btn-add-callback (lambda (disp btn)
(declare (ignore disp btn))
(move-txt-content fruit-edit fruit-list )))
(btn-add (make-instance 'gfw:button
:callback btn-add-callback
:style '(:default-button)
:text "Add"
:parent btn-panel))
(btn-remove-callback (lambda (disp btn)
(declare (ignore disp btn))
(remove-item fruit-list fruit-edit)))
(btn-remove (make-instance 'gfw:button
:callback btn-remove-callback
:style '(:default-button)
:text "Remove"
:parent btn-panel))
(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 btn-panel)))
(declare (ignore fruit-label btn-add btn-remove btn-exit))
(setf (gfw:minimum-size fruit-list) (gfs:make-size :width 300 :height 77))
(setf (gfw:minimum-size dlg) (gfs:make-size :width 400 :height 300 ))
(setf (gfw:minimum-size fruit-label) (gfs:make-size :width 50 :height 23))
(setf (gfw:minimum-size fruit-edit) (gfs:make-size :width 120 :height 23))
(setf (gfw:minimum-size fruit-list) (gfs:make-size :width 300 :height 77))
(gfw:pack dlg)
(setf (gfw:text fruit-edit) "")
(gfw:show dlg t)
dlg))
(defun fruit-basket-main ()
(fruit-dlg "Lisp Fruit basket demo" '(:appli) nil)
)
(defun fruitbasket ()
(gfw:startup "Window/Dialog Tester" #'fruit-basket-main))
More information about the Graphic-forms-devel
mailing list