2 Jun 2012 20:04
4 Jun 2012 18:30
Re: Set xscrollcommand to a lisp function
Vitaŭt Bajaryn <vitaut.bayaryn <at> gmail.com>
2012-06-04 16:30:01 GMT
2012-06-04 16:30:01 GMT
On 2 June 2012 21:04, Vitaŭt Bajaryn <vitaut.bayaryn <at> gmail.com> wrote:
>
> How can I set :xscrollcommand configure option to a lisp function?
I figured I can do something like that:
;;;;
(in-package #:ltk)
(defun (setf x-scroll-command) (fun widget)
(let ((name (create-name)))
(add-callback name fun)
(format-wish "~a configure -xscrollcommand {callback ~a}"
(widget-path widget) name)))
(export 'x-scroll-command)
;;;;
But callback needs additional parameters and I don't know how to call
a function in tcl.
_______________________________________________
ltk-user site list
ltk-user <at> common-lisp.net
http://common-lisp.net/mailman/listinfo/ltk-user
4 Jun 2012 19:29
Re: Set xscrollcommand to a lisp function
Vitaŭt Bajaryn <vitaut.bayaryn <at> gmail.com>
2012-06-04 17:29:51 GMT
2012-06-04 17:29:51 GMT
On 4 June 2012 19:30, Vitaŭt Bajaryn <vitaut.bayaryn <at> gmail.com> wrote:
> On 2 June 2012 21:04, Vitaŭt Bajaryn <vitaut.bayaryn <at> gmail.com> wrote:
>>
>> How can I set :xscrollcommand configure option to a lisp function?
>
> I figured I can do something like that:
> ;;;;
> (in-package #:ltk)
>
> (defun (setf x-scroll-command) (fun widget)
> (let ((name (create-name)))
> (add-callback name fun)
> (format-wish "~a configure -xscrollcommand {callback ~a}"
> (widget-path widget) name)))
> (export 'x-scroll-command)
> ;;;;
> But callback needs additional parameters and I don't know how to call
> a function in tcl.
I solved this question. Maybe make (setf x-scroll-command) a part of
ltk? Maybe someone except me would want to call a function when a
widget is scrolled.
;;;;
(in-package #:ltk)
(eval-when (:load-toplevel)
(setf *init-wish-hook*
(append *init-wish-hook*
(list
(lambda ()
(send-wish
"proc callback2val {s val1 val2} {global server; puts $server
\"(:callback \\\"$s\\\" $val1 $val2)\"} "))))))
(defun (setf x-scroll-command) (fun widget)
(let ((name (create-name)))
(add-callback name fun)
(format-wish "~a configure -xscrollcommand {callback2val ~a}"
(widget-path widget) name)))
(export 'x-scroll-command)
;;;;
_______________________________________________
ltk-user site list
ltk-user <at> common-lisp.net
http://common-lisp.net/mailman/listinfo/ltk-user
4 Jun 2012 21:59
Re: Set xscrollcommand to a lisp function
cage <cage <at> katamail.com>
2012-06-04 19:59:16 GMT
2012-06-04 19:59:16 GMT
On Mon, Jun 04, 2012 at 08:29:51PM +0300, Vitaŭt Bajaryn wrote: [...] > > I solved this question. Maybe make (setf x-scroll-command) a part of > ltk? IMHO this would be a good idea! C. _______________________________________________ ltk-user site list ltk-user <at> common-lisp.net http://common-lisp.net/mailman/listinfo/ltk-user
RSS Feed