This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-17
Channels
- # announcements (6)
- # beginners (117)
- # calva (22)
- # cider (7)
- # clara (56)
- # clj-kondo (8)
- # cljdoc (3)
- # cljfx (26)
- # clojure (58)
- # clojure-czech (2)
- # clojure-europe (20)
- # clojure-greece (1)
- # clojure-india (7)
- # clojure-nl (11)
- # clojure-uk (100)
- # clojurescript (48)
- # conjure (24)
- # cursive (117)
- # data-science (3)
- # datascript (5)
- # datomic (33)
- # emacs (29)
- # figwheel-main (3)
- # fulcro (12)
- # jobs (1)
- # malli (40)
- # parinfer (4)
- # pathom (1)
- # quil (2)
- # re-frame (17)
- # reagent (20)
- # reitit (1)
- # reveal (97)
- # ring (5)
- # shadow-cljs (11)
- # spacemacs (12)
- # sql (4)
- # tools-deps (18)
- # xtdb (25)
When I try to add a stylesheet with cljfx css, components no longer work for me, running any code which should show a view fails silently, and no longer works until I restart the jvm, even if i remove the stylesheet from the scene afterwards. Does this sound familiar to anyone? I'm on windows and java 13
(def style
(css/register ::style
(let [padding 10
text-color "#111111"]
;; you can put style settings that you need to access from code at keyword keys in a
;; style map and access them directly in an app
{::padding padding
::text-color text-color
;; string key ".root" defines `.root` selector with these rules: `-fx-padding: 10;`
".root" {:-fx-padding padding}
".label" {:-fx-text-fill text-color
:-fx-wrap-text true}
".button" {:-fx-text-fill text-color
;; vector values are space-separated
:-fx-padding ["4px" "8px"]
;; nested string key defines new selector: `.button:hover`
":hover" {:-fx-text-fill :black}}})))
(fx/on-fx-thread
(fx/create-component
{:fx/type :stage
:showing true
:title "Cljfx example"
:width 300
:height 100
:scene {:fx/type :scene
:stylesheets [(::css/url style)]
:root {:fx/type :v-box
:alignment :center
:children [{:fx/type :label
:text "Hello world"}]}}}))
@U064UGEUQ - your code worked for me when I added :style-class ["label"] to the label node my env: Win10, Java 14.0.2 cljfx 1.7.10, clojure 1.10.1 :scene {:fx/type :scene :stylesheets [(::css/url style)] :root {:fx/type :v-box :alignment :center :children [{:fx/type :label :style-class ["label"] :text "Hello world"}]}}
What is the result of evaluating (System/getProperty "java.protocol.handler.pkgs" "")
?
Yeah I'm wondering where the errors are going haha. I can try Java 14 out later tonight
Worked for me on windows with 13.0.1 JDK:
PS C:\Users\Vlaaad> clj -Sdeps "{:deps {cljfx/cljfx {:mvn/version """"1.7.10""""} cljfx/css {:mvn/version """"1.1.0""""}}}"
Clojure 1.10.1
user=> (System/getProperty "java.version")
"13.0.1"
user=> (require '[cljfx.css :as css] '[cljfx.api :as fx])
nil
user=> (def style
(css/register ::style
(let [padding 10
text-color "#ff1111"]
;; you can put style settings that you need to access from code at keyword keys in a
;; style map and access them directly in an app
{::padding padding
::text-color text-color
;; string key ".root" defines `.root` selector with these rules: `-fx-padding: 10;`
".root" {:-fx-padding padding}
".label" {:-fx-text-fill text-color
:-fx-wrap-text true}
".button" {:-fx-text-fill text-color
;; vector values are space-separated
:-fx-padding ["4px" "8px"]
;; nested string key defines new selector: `.button:hover`
":hover" {:-fx-text-fill :black}}})))
#'user/style
user=> (fx/on-fx-thread
(fx/create-component
{:fx/type :stage
:showing true
:title "Cljfx example"
:width 300
:height 100
:scene {:fx/type :scene
:stylesheets [(::css/url style)]
:root {:fx/type :v-box
:alignment :center
:children [{:fx/type :label
:text "Hello world"}]}}}))
#object[clojure.lang.Delay 0x373052b5 {:status :pending, :val nil}]
user=>
I downloaded the JDK from here https://jdk.java.net/archive/
Thanks for all the research! I'll take another look at it in a bit, I'm probably doing something dumb
Ok I finally tracked this down. By default I use a repl that starts a sub-repl that uses fipp
as a printer, like this
(binding [*print-length* 20
*print-level* 10]
(main/repl
:caught pst
:print fipp
))
For some reason, this is what was causing the issue with the stylesheet. If I remove this it works.