Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting values from widgets doesn't work #319

Closed
srgk26 opened this issue Jun 23, 2019 · 1 comment
Closed

Extracting values from widgets doesn't work #319

srgk26 opened this issue Jun 23, 2019 · 1 comment

Comments

@srgk26
Copy link

srgk26 commented Jun 23, 2019

Hi! It would be great if someone would be able to help out. I have this code, just to test out filepicker to see if the file name/path gets reflected in the output. This code should give the file name/path into a new Blink window, which I'm not getting:

using Blink, Interact
w = Blink.Window()
function inputs()
	test = Interact.filepicker()
	next = html"""<button onclick='Blink.msg("press", "foo")'>Next</button>"""
	Widget(["test"=>test, "next"=>next])
end
page = Interact.node(:html,
	Interact.node(:p, inputs()["test"]),
	Interact.node(:p, inputs()["next"]))
Blink.body!(w, page)

Blink.handle(w, "press") do args...
	body!(w, inputs()["test"][]::String)
end

I'm not getting any file name out of this. I tried the same for dropdown menu:

using Blink, Interact
w = Blink.Window()
function inputs()
	test = Interact.dropdown(["dog", "cat", "dolphin"])
	next = html"""<button onclick='Blink.msg("press", "foo")'>Next</button>"""
	Widget(["test"=>test, "next"=>next])
end
page = Interact.node(:html,
	Interact.node(:p, inputs()["test"]),
	Interact.node(:p, inputs()["next"]))
Blink.body!(w, page)

Blink.handle(w, "press") do args...
	body!(w, inputs()["test"][]::String)
end

The output gives the first option on the list, even though I would've selected the 2nd or 3rd options. And this code worked before though, that's why I'm confused. Though I used my Mac OS previously, just recently switched to Arch Linux. But I built Julia using the official binary in the https://julialang.org/downloads page, not compiled from source using package manager, to avoid the 'Arpack' dependency build issues. The Julia REPL also keeps giving warnings : Warning: Please upgrade WebIO for a smoother integration with Blink.. I'm not sure if this has anything to do with this, but my WebIO has been updated to the latest #master version.

@srgk26
Copy link
Author

srgk26 commented Jul 3, 2019

Ok, I see the problem now. I should do

using Blink, Interact
w = Blink.Window()
function inputs()
	test = Interact.filepicker()
	next = html"""<button onclick='Blink.msg("press", "foo")'>Next</button>"""
	Widget(["test"=>test, "next"=>next])
end
InputsFn = inputs()
page = Interact.node(:html,
	Interact.node(:p, InputsFn ["test"]),
	Interact.node(:p, InputsFn ["next"]))
Blink.body!(w, page)

Blink.handle(w, "press") do args...
	body!(w, InputsFn ["test"][]::String)
end

This works for some reason. So I'm closing the issue now.

@srgk26 srgk26 closed this as completed Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant