Hi,
just FYI (if someone googles this question...):
After some code inspection I found out that the "cut-and-paste-mixin" sends pointer-events in its dispatch-event :around method to eos/shift-click if the shift key is pressed. This seems related to some historic semantics of shift-click behaviour for setting and dragging points as explained in the "text-selection.lisp" file.
I couldn't find anything in the clim specific docs. May it'd be sensible to add this information (maybe at bauhh.dyndns.org?).
-- Orm
Greetings Orm,
CLIM is a layered toolkit, the implementation in "text-selection.lisp" is using the lower level where you handle events yourself. For example `dispatch-event`, `handle-repaint`, `handle-event` are all part of CLIM.
I am attaching an example program which shows an integer value which can be increased or decreased with mouse wheel. Just put the following in a file and load it:
------------------------------------------------------------------------ (eval-when (:compile-toplevel :load-toplevel :execute) (unless (find-package "CLIM") (ql:quickload "mcclim")))
(in-package :clim-user)
(defclass counter-pane (basic-pane) ((counter :initform 0)))
(defmethod handle-event ((pane counter-pane) (event climi::pointer-scroll-event)) (with-slots ((counter counter)) pane (setf counter (+ counter (climi::pointer-event-delta-y event)))) (repaint-sheet pane +everywhere+))
(defmethod handle-repaint ((pane counter-pane) region) (with-bounding-rectangle* (min-x min-y max-x max-y) region (draw-rectangle* pane min-x min-y max-x max-y :ink +sky-blue+) (draw-text* pane "Use Mouse Wheel to increase/decrease counter." 20 20) (with-slots ((counter counter)) pane (with-text-size (pane 48) (draw-text* pane (format nil "~A" counter) 170 180)))))
(define-application-frame counter-frame () () (:pane (clim:make-pane 'counter-pane)) (:geometry :width 400 :height 400))
(defun show-counter () (let ((frame (make-application-frame 'counter-frame))) (run-frame-top-level frame)))
(show-counter) ------------------------------------------------------------------------ Since gestures on McCLIM are currently broken, You can implement multiple-select (mentioned in your parent mail) as text-selection is implemented/
Good luck,
Nisar Ahmad
On 08/05/2018 10:30 PM, Orm Finnendahl wrote:
Hi,
just FYI (if someone googles this question...):
After some code inspection I found out that the "cut-and-paste-mixin" sends pointer-events in its dispatch-event :around method to eos/shift-click if the shift key is pressed. This seems related to some historic semantics of shift-click behaviour for setting and dragging points as explained in the "text-selection.lisp" file.
I couldn't find anything in the clim specific docs. May it'd be sensible to add this information (maybe at bauhh.dyndns.org?).
-- Orm
Hi Nisar,
thanks for your support, that's really appreciated! I'll follow the suggested path.
On my machine your example causes the problem that the event handler for the scroll wheel is called twice (de/incrementing the counter twice). Consulting xev reveals that on scroll wheel movement X generates two events: A button press and a button release event of button 4/5.
I corrected this in the event-handler routine in input.lisp of the mcclim clx backend and filed a pull request on github.
-- Orm
Am Sonntag, den 05. August 2018 um 23:55:54 Uhr (+0530) schrieb Nisar Ahmad:
Greetings Orm,
CLIM is a layered toolkit, the implementation in "text-selection.lisp" is using the lower level where you handle events yourself. For example `dispatch-event`, `handle-repaint`, `handle-event` are all part of CLIM.
I am attaching an example program which shows an integer value which can be increased or decreased with mouse wheel. Just put the following in a file and load it:
(eval-when (:compile-toplevel :load-toplevel :execute) (unless (find-package "CLIM") (ql:quickload "mcclim")))
(in-package :clim-user)
(defclass counter-pane (basic-pane) ((counter :initform 0)))
(defmethod handle-event ((pane counter-pane) (event climi::pointer-scroll-event)) (with-slots ((counter counter)) pane (setf counter (- counter (climi::pointer-event-delta-y event)))) (repaint-sheet pane +everywhere+))
(defmethod handle-repaint ((pane counter-pane) region) (with-bounding-rectangle* (min-x min-y max-x max-y) region (draw-rectangle* pane min-x min-y max-x max-y :ink +sky-blue+) (draw-text* pane "Use Mouse Wheel to increase/decrease counter." 20 20) (with-slots ((counter counter)) pane (with-text-size (pane 48) (draw-text* pane (format nil "~A" counter) 170 180)))))
(define-application-frame counter-frame () () (:pane (clim:make-pane 'counter-pane)) (:geometry :width 400 :height 400))
(defun show-counter () (let ((frame (make-application-frame 'counter-frame))) (run-frame-top-level frame)))
(show-counter)
Since gestures on McCLIM are currently broken, You can implement multiple-select (mentioned in your parent mail) as text-selection is implemented/
Good luck,
Nisar Ahmad
On 08/05/2018 10:30 PM, Orm Finnendahl wrote:
Hi,
just FYI (if someone googles this question...):
After some code inspection I found out that the "cut-and-paste-mixin" sends pointer-events in its dispatch-event :around method to eos/shift-click if the shift key is pressed. This seems related to some historic semantics of shift-click behaviour for setting and dragging points as explained in the "text-selection.lisp" file.
I couldn't find anything in the clim specific docs. May it'd be sensible to add this information (maybe at bauhh.dyndns.org?).
-- Orm
Hi List,
Am Sonntag, den 05. August 2018 um 23:55:54 Uhr (+0530) schrieb Nisar Ahmad:
Since gestures on McCLIM are currently broken, You can implement multiple-select (mentioned in your parent mail) as text-selection is implemented/
unfortunately my pane is an application-frame with incremental updating-output and that would require renaming/duplicating quite a lot of class and method definitions in my application. Just redefining standard-output-class without the cut-and-paste-mixin works, but seems a little hackish. I proposed to use an init-argument :cut-and-paste-mixin which defaults to t as this seems to me the least invasive form to establish a sensitive way to be able to handle shift-click events in your own application-panes. I'd be willing to provide the code and opened an issue on github, although this, too is admittedly not a real solution, but rather a workaround.
-- Orm