On Feb 19, 11:58 am, BerlinBrown <berlin.br...@gmail.com> wrote:
> I am working with this SWT application. For most calls with SWT, if
> you want to request data from a widget, then you must do so through
> the syncExec or asynExec. These methods require an implementation of
> runnable as an argument.
>
> This works fine for 'setting' a value, but I have trouble when I need
> to get a value from a widget, like a Textarea. This is the macro that
> I created and it runs, but I don't think it is working properly. Does
> anyone have suggestions?
>
> Usage:
> term (get-sync-call disp (. box getText))
>
> (defmacro get-sync-call
> "Synchronous execute call. Create a proxy Runnable object and then
> execute the
> body code"
> [disp & body]
> ;;;;;;;;;;;;;;
> `(let [val-res# (agent nil)]
> ;;(. ~disp syncExec
> (. ~disp syncExec (proxy [Runnable] [] (run [] (send val-res# (fn
> [_#] ~...@body)))))
> @val-res#))
(defmacro get-sync-call
"Synchronous execute call. Create a proxy Runnable object and then
execute the
body code"
[disp & body]
;;;;;;;;;;;;;;
`(let [val-res# (ref nil)]
;;(. ~disp syncExec (proxy [Runnable] [] (run [] (send val-res#
(fn [_#] ~...@body)))))
(. ~disp syncExec (proxy [Runnable] [] (run [] (dosync (ref-set
val-res# ~...@body)))))
(. Thread sleep 50)
(deref val-res#)))
OK, I added this, don't know why I added Thread.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---