Skip to content

Instantly share code, notes, and snippets.

@daveray
Created January 22, 2014 07:08
Show Gist options
  • Save daveray/8554640 to your computer and use it in GitHub Desktop.
Save daveray/8554640 to your computer and use it in GitHub Desktop.
Seesaw radio button binding example
(use 'seesaw.core)
(require '[seesaw.bind :as b])
(def f (let [bg (button-group)
f (-> (frame :title "test"
:content (border-panel :center (text :id :text :text "hi")
:south (horizontal-panel :items
[(radio :group bg :text "enabled")
(radio :group bg :text "disabled")])))
pack!
show!)]
(b/bind (b/selection bg)
; when a radio button is clicked the selection temporarily goes to nil
; so filter those out
(b/filter identity)
(b/transform #(= "enabled" (text %)))
(b/property (select f [:#text]) :enabled?))
f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment