Hi Shashi,
Thanks for your prompt reply! To make my question clearer, please take a 
look at the following (contrived) example:






*using Reactive, Interact, DataStructuresp = Input(3.);α = @lift p/2;m = 
@lift Input(α);lift(a -> togglebuttons(OrderedDict(["one", "two"], [a,2a]), 
signal=m), α)*

The problem with this is that now the togglebuttons seem to no longer 
affect the value of the signal *m*, that stays constant at 1.5 no matter 
which option the user selects. 
This is what I meant earlier when saying I would like to initialize a 
signal with a value that depends on another signal. This is done in the 
line 
*m = @lift Input(α);* in the example above. But it seems to break the 
behaviour of the toggle buttons.

Tnx,
//A


On Wednesday, March 25, 2015 at 2:55:44 PM UTC+1, Shashi Gowda wrote:
>
> 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 <[email protected] 
> <javascript:>> 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 <[email protected]> 
>>> 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