Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a way to remove the braces from the front end output associated with DynamicModule? For instance:

a=0;
DynamicModule[{x}, {Slider[Dynamic[x]], Dynamic[If[x>.5,a=1;,{}]]}]

This returns a slider with braces around it. Is there a way to avoid or remove the braces?

share|improve this question
2  
Row@{Slider...? This is what you want? –  Kuba Sep 19 '13 at 5:57
    
@Kuba: Yes! But can they also be eliminated from the Dynamic[If[...]]? –  user8454 Sep 19 '13 at 6:01
2  
@user8454 does Dynamic[If[x > .5, a = 1;, Spacer[0]]] do what you want? –  Mr.Wizard Sep 19 '13 at 6:02
    
Yes @Mr.Wizard! Sorry @Kuba! Thanks guys! –  user8454 Sep 19 '13 at 6:03
    
@Kuba Do you care to post both parts as an answer? –  Mr.Wizard Sep 19 '13 at 6:04
show 1 more comment

1 Answer

up vote 5 down vote accepted

Quick fix to your code would be to add Row and Spacer[0].

a=0;
DynamicModule[{x}, Row@{Slider[Dynamic[x]], Dynamic[If[x>.5,a=1;, Spacer[0]]]}]

Instead of Spacer[0] you can use empty string: "", or Invisible[""].

Those braces are in output because you put them there. To know more about organizing an output, take a look at documentation:

tutorial / Grids Rows and Columns overview

there are also interesting related Q&A-s here on Mathematica.SE, for example:

Why use Column with Rows instead of Grid?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.