[graphic-forms-devel] List box not resizing.

Ken Perry whistler at blinksoft.com
Fri Sep 7 06:17:26 UTC 2007



I followed your instructions and added the minimum size I have tried all
kinds of values for my controls but what seems to be happening is when the
control is initialized it is one size and after I add the first word it is
another size but after I add the third word it doesn't get any bigger.  What
I want is it to start out at the right size and thus not cut off what I add.
If you want to see what I mean run the following program and add the fruits
in this order

Apple
Orange
Pine Apple 

Thanks and the following sizes are after trying everything from 200 by 150
to 400 by 300 for the dialog and all kinds of sizes so it might not be the
best look but I am just trying to get it to work then I can pretty it up 

Thanks,

Ken

---c:\graphic-forms\src\tests\uitoolkit\fruitbasket.lisp---

(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 dlg))
(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