Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;; ... namespace stuff goes here
- (def f (frame :title "Character Creator - The Feather System" :on-close :exit :size [1100 :by 500]))
- (defn display [content]
- (config! f :content content)
- content)
- (defn acquire [kw] (select (to-root f) kw))
- ;;;;;;;;; AFTER MANY DECLARATIONS...
- (defn armor-res-util [armor-num]
- (println (str "sample keyword: " (keyword (str "#armor-" armor-num "-res-0-kind")) " sample acquire vector: " [(keyword (str "#armor-" armor-num "-res-0-kind"))]))
- (str "Total Resistance Value: "
- (+ (* (values-of-types (selection (acquire [(keyword (str "#armor-" armor-num "-res-0-kind"))]))) (selection (acquire [(keyword (str "#armor-" armor-num "-res-0-amount"))])))
- (* (values-of-types (selection (acquire [(keyword (str "#armor-" armor-num "-res-1-kind"))]))) (selection (acquire [(keyword (str "#armor-" armor-num "-res-1-amount"))])))
- (* (values-of-types (selection (acquire [(keyword (str "#armor-" armor-num "-res-2-kind"))]))) (selection (acquire [(keyword (str "#armor-" armor-num "-res-2-amount"))])))
- )))
- ;;;;MUCH LATER...
- (defn make-window []
- ;;;;;;;;;;;;;;;;;;;;;;;; ...LOTS OF GUI STUFF GOES HERE
- (combobox :id :armor-0-res-0-kind :visible? false :model valid-types
- :listen [:selection (fn [ev] (swap! current-char assoc-in [:armor 0 :resistances 0 :amount-kind] (selection ev))
- (config! (acquire [:#total-res-value]) :text (armor-res-util 0)))
- ])
- (slider :id :armor-0-res-0-amount :visible? false :value 0 :min -3 :max 3
- :listen [:selection (fn [ev] (swap! current-char assoc-in [:armor 0 :resistances 0 :amount] (selection ev))
- (config! (acquire [:#armor-0-res-0-count]) :text (str " " (selection ev)))
- (config! (acquire [:#total-res-value]) :text (armor-res-util 0)))
- ])
- (label :id :armor-0-res-0-count :text " 0")
- ;;;;;;;;;;;;;;;;;;;;;;;; ...TWO MORE JUST LIKE WHAT IS ABOVE THIS, THEN WRAPPING UP GUI STUFF
- (defn -main [& args]
- (invoke-later
- (display (make-window))
- (-> f show!)))
- ;; The problem seems to be that the function armor-res-util gets executed before all of the id's it needs
- ;; get declared. It shouldn't be executing at all until one of the slider's or combobox's selection events gets called!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement