Hei,
I'm in the process of learning clim, I have a small code example under. What I want to do is to add my own pane to a the display pane. Later I want to be able to move the pane around in the pane by clicking on the pane and drag it to the new place.
My first problem is that I don't know how to insert new panes into the "display" pane.. The with-output-as-gadget require a stream, and I don't know how to obtain this stream, and if the example under will work.
(define-application-frame test () () (:panes (display :application :output-record (make-instance 'standard-tree-output-record)) (my-interactor :interactor)) (:layouts (:default (vertically (:height 500 :width 400) (2/3 display) (1/3 my-interactor)))))
(define-test-command (com-add :name t :menu "Add") () (with-output-as-gadget (stream) (make-pane 'push-button :label "Click here to exit" :activate-callback #'(lambda (button) (frame-exit (pane-frame button)))))))
On 15/05/07, Knut Olav Bøhmer bohmer@gmail.com wrote: <-cut->
(define-test-command (com-add :name t :menu "Add") () (with-output-as-gadget (stream) (make-pane 'push-button :label "Click here to exit" :activate-callback #'(lambda (button) (frame-exit (pane-frame button)))))))
I found an example that did what I want.
(define-petrinet-command (com-dynamic :menu t :name t) () (with-look-and-feel-realization (*default-frame-manager* *application-frame*) (let ((button (make-pane 'push-button :label "Dynamically Generated")) (layout-pane (find-pane-named *application-frame* 'simulation))) (sheet-adopt-child layout-pane button))))
But why should I not use presentations? What are presentation-types related to what I'm doing?
On 17/05/07, Knut Olav Bøhmer bohmer@gmail.com wrote:
But why should I not use presentations? What are presentation-types related to what I'm doing?
I have ended up using presentations. Now I'm trying to move the objects, but the objects don't "stick" to the new place..
Here is the relevant part of my code.
(define-presentation-to-command-translator move-place-translator (place com-move-place simulation :documentation "Move the place") (presentation x y) (list presentation x y))
(define-simulation-command (com-move-place) ((place 'place) (x 'real) (y 'real)) (erase-output-record place *standard-output*) (setf (output-record-position place) (drag-output-record *standard-output* place :finish-on-release t)))
On 19/05/07, Knut Olav Bøhmer bohmer@gmail.com wrote:
On 17/05/07, Knut Olav Bøhmer bohmer@gmail.com wrote:
I have ended up using presentations. Now I'm trying to move the objects, but the objects don't "stick" to the new place..
Solved.. It was my :display-funcion that redrawed the original image.