using Interact, Reactive

α = Input(2)
display(togglebuttons(["one" => 1, "two" => 2], signal=α))
signal(α)

results in "two" being selected initially. If you want to set initial label
to be selected, you can use the value_label keyword argument

If you want the selection to change wrt another signal, you will need to
lift the togglebuttons and set the value_label, but the value in the input
won't change without user interaction...

I may not have understood your question fully well. I hope you can play
around with value_label and let me know where you get!

Thanks
Shashi


On Tue, Mar 24, 2015 at 10:23 PM, Andrei Berceanu <andreiberce...@gmail.com>
wrote:

> OK, I see. Now my problem is that, in my code, the initial value should
> then depend on another signal, and I have found no way of resolving this.
> The actual code I have is
>
>
>
>
>
>
>
>
>
>
> *lift(a -> togglebuttons([    "Landau" => (                 (n,m) ->
> one(Complex{Float64}), (n,m) -> one(Complex{Float64}),
> (n,m) -> exp(-im*2π*a*m), (n,m) -> exp(im*2π*a*m)                 ),
> "Symmetric" => (                    (n,m) -> exp(-im*π*a*n), (n,m) ->
> exp(im*π*a*n),                    (n,m) -> exp(-im*π*a*m), (n,m) ->
> exp(im*π*a*m)    )    ], signal=ft), α)*
>
> So I would like to initialize *ft* beforehand with, say, the first value
> in my Dict, the one under the key "Landau", but this depends on the value
> of the signal *α.*
> On Tuesday, March 24, 2015 at 3:43:04 PM UTC+1, Shashi Gowda wrote:
>>
>> Not a bug, if you are passing in your own input signal to widgets, you
>> need to take care of maintaining the right initial values. It's also better
>> to use OrderedDict from DataStructures package here to keep the ordering of
>> the key-value pairs.
>>
>>
>>
>> On Tue, Mar 24, 2015 at 7:39 PM, Andrei Berceanu <andreib...@gmail.com>
>> wrote:
>>
>>> Consider the following code
>>>
>>>
>>>
>>>
>>>
>>>
>>> *using Reactive, Interactα = Input(0)togglebuttons(["one" => 1, "two" =>
>>> 2], signal=α)signal(α)*I would expect the value of *α *to change after
>>> executing the *togglebuttons*(..) line, however this is not the case.
>>> *signal(α) *on the next line shows that *α *is still 0, even though one
>>> of the buttons is pre-selected. One has to press the buttons at least once
>>> to change the value of *α*.
>>> Can this behaviour be changed? Is it a bug?
>>>
>>
>>

Reply via email to