Can you offer advice on how to develop... iteratively? incrementally? live? whatever people call it... I want my code changes to get incorporated into the running app.
(defonce app (atom nil))
(defn view
[& args]
(ui/label "hi"))
(reset! app (java2d/run (component/make-app #'view)))
I have this ^
Even if I change something in view and call ((:membrane.java2d/repaint @app)) nothing changes in the ui.Thanks!
@rgkirch, You can try something like:
(defonce app (atom nil))
(defn view
[& args]
(ui/label "hi"))
(def window-info (java2d/run #'view))
(def repaint (::java2d/repaint window-info))
(add-watch #'view ::repaint
(fn [_ _ _ _]
(repaint)))The issue is that component/make-app only works with components created with component/defui.
If you're not using defui and friends, then you can just pass the function.
Woa, neat. I forgot add-watch worked for more than just atoms.
Why can't I edit text in my textarea?
(defui view
[arg]
(basic/textarea {:text "hi"}))
(defonce window (java2d/run
(component/make-app #'view {})))
((:membrane.java2d/repaint window))
I can highlight the text but I can't edit it. I think I should be able to since the tutorial example shows editing the text in the gif.It works if I copy over the example. I can figure this out.
Oh.
(defui view
[{:keys [input]
:or {input ""}}]
(basic/textarea {:text input}))
I have to rerun the app if I change the name input. I guess the app is populating :input in the context and if I redef the defui to use like :my-input then there's no data there.No data there in the context.
It looks like you figured it out, but since textareas are stateful components, the :text property must be derived from some input property to "update" it.