This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-10
Channels
- # adventofcode (54)
- # announcements (30)
- # asami (13)
- # aws (10)
- # babashka (16)
- # babashka-sci-dev (44)
- # beginners (95)
- # calva (63)
- # clara (10)
- # clj-kondo (3)
- # cljfx (6)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (68)
- # clojure-europe (59)
- # clojure-nl (7)
- # clojure-norway (12)
- # clojure-spec (6)
- # clojure-uk (6)
- # clojurescript (4)
- # component (4)
- # conjure (5)
- # datomic (3)
- # deps-new (1)
- # events (4)
- # exercism (1)
- # figwheel-main (1)
- # fulcro (33)
- # gratitude (1)
- # improve-getting-started (3)
- # jobs (3)
- # lsp (5)
- # malli (10)
- # membrane (5)
- # music (3)
- # nextjournal (6)
- # off-topic (42)
- # pedestal (2)
- # polylith (14)
- # portal (11)
- # re-frame (42)
- # releases (3)
- # reveal (4)
- # shadow-cljs (62)
- # tools-build (1)
- # tools-deps (3)
- # web-security (1)
- # xtdb (3)
Is there a way to get a reference to the top level Stage in an event handler?
The :on-action
event contains the key :fx/event
which is an ActionEvent
. With this object I can sometimes get all the way to the top and get the top most Window
, but in this case I have a MenuItem
and don’t see a way to obtain a reference to the Stage.
This is the code this is based on https://github.com/cljfx/cljfx/pull/40#issuecomment-544256262
I've used ext-on-instance-lifecycle in the past to catch a reference to the top level stage and store it in a promise.
I’ll look into that! Might have to do this as a workaround.
Would love to hear back if there's something simpler. Seems likely you could just navigate up the Node tree but that doesn't feel more elegant.
when looking in event, did you check both .getSource and .getTarget if it's possible to reach stage?
IIRC both source and target give me a MenuItem. From the MenuItem I don’t see a way back to reach the parent stage. I tried getParent on it and I reach the Menu which is a dead end. On mobile, excuse formatting