OK, with some trial-and-error, now I've understood the use of lift (it
accept a function as first parameter that can render some widget, during
"transformation" of signal passed as second parameter).
But now, problem is: how can I intercept signal generated from button
pressure?
In Escher example 'form.jl' trigger!() is used, but example doesn't work ...
Any suggestion is appreciated
Leonardo
Il giorno martedì 23 giugno 2015 20:51:04 UTC+2, Leonardo ha scritto:
>
> Thanks,
> but also with your code the error persists:
>
> `consume` has no method matching consume(::Function, ::Input{Int32})
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Escher\src\cli\serve.jl:134
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Mux\src\Mux.jl:15
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Mux\src\Mux.jl:8
> in splitquery at C:\Users\Leonardo\.julia\v0.3\Mux\src\basics.jl:28
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Mux\src\Mux.jl:8
> in wcatch at C:\Users\Leonardo\.julia\v0.3\Mux\src\websockets.jl:12
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Mux\src\Mux.jl:8
> in todict at C:\Users\Leonardo\.julia\v0.3\Mux\src\basics.jl:21
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Mux\src\Mux.jl:12 (repeats
> 2 times)
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Mux\src\Mux.jl:8
> in anonymous at C:\Users\Leonardo\.julia\v0.3\Mux\src\server.jl:36
> in handle at C:\Users\Leonardo\.julia\v0.3\WebSockets\src\WebSockets.jl:
> 287
> in on_message_complete at C:\Users\Leonardo\.julia\v0.3\HttpServer\src\
> HttpServer.jl:359
> in on_message_complete at C:\Users\Leonardo\.julia\v0.3\HttpServer\src\
> RequestParser.jl:99
> in pointer at pointer.jl:29 (repeats 2 times)
> (also form.jl, despite I've downloaded latest versionfrom github dated
> about 1 month ago, doesn't work)
>
> Leonardo
>
>
>
> Il giorno martedì 23 giugno 2015 15:26:29 UTC+2, Shashi Gowda ha scritto:
>>
>> consume is essentially an alias to lift. Escher now lets you embed
>> interactive UIs in static surroundings. So your example can be simplified
>> to:
>>
>> using Color
>>
>> with_hue(hue, tile=size(4em, 4em, empty)) =
>> fillcolor(HSV(hue, 0.6, 0.6), tile)
>>
>> function main(window)
>> push!(window.assets, "widgets")
>>
>> xt = Input(0)
>>
>> vbox(
>> subscribe(slider(0:360), xt),
>> consume(with_hue, xt)
>> )
>>
>> end
>>
>>
>>
>>
>> On Tue, Jun 23, 2015 at 12:29 PM, Leonardo <[email protected]> wrote:
>>
>>> Hello,
>>> I'm a newbie in Julia but I'm very interested to use it in scientific /
>>> numeric application with some minimal User Interface, and I think that
>>> Escher is great for this scope, useful also for remote computation.
>>>
>>> Unfortunately I've some problem running simple demos (I use win32 Julia
>>> in Win7 with latest Firefox)
>>>
>>> Trying to understand use of buttons, I've found example *form.jl *included
>>> in Escher, but it display at the bottom of page Dict{Any,Any}() and
>>> button doesn't work.
>>>
>>> Moreover I've extracted from *Reactive Programming Guide* (*reactive.jl*
>>> doc included in Escher) a simple hue example (attached), but doesn't work
>>> in original version because julia cannot found consume()
>>> using Escher
>>> using Color
>>>
>>>
>>> xt = Input(0)
>>>
>>> with_hue(hue, tile=size(4em, 4em, empty)) =
>>> fillcolor(HSV(hue, 0.6, 0.6), tile)
>>>
>>> function main(window)
>>> # Load HTML dependencies related to widgets
>>> push!(window.assets, "widgets")
>>>
>>> lift(xt) do x
>>> slider_and_huebox(x) = vbox(
>>> subscribe(slider(0:360), xt),
>>> "The current hue is: $x",
>>> with_hue(x)
>>> )
>>>
>>> consume(slider_and_huebox,xt)
>>> end
>>> end
>>>
>>> (I've found a consume()in Julia in file *task.jl*, but it has a
>>> completely different signature and use)
>>>
>>>
>>> Maybe I made trivial mistakes, but I cannot found right solutions.
>>> Someone can help me?
>>>
>>> Many thanks in advance
>>>
>>> Leonardo
>>>
>>>
>>