Message Boards Message Boards

1 Reply
2 Total Likes
View groups...
Share this post:

Dynamically name tabs in a TabView

Posted 11 years ago
Happy New Year!

I want to dynamically name tabs in a TabView based upon variables I set elsewhere in my model.  I am able to dynamically set the values in a TogglerBar using the same variables but for the tabs I am getting the variable name with $$ appended to the end.  The variable names are c1Name, c2Name, etc.

  - Tabs in TabView showing only the variable name + $$

- TogglerBar correctly displaying the values of the variables.

Any suggestions on how to get the tabs to be dynamically updated to reflect the variables?


POSTED BY: Tim Heger
Happy New Year Tim!

Is this similar to what you wanted? It's a bit of a toy as I'm just passing by on a Sunday evening, note I've used Dynamic around all the instances of the label rather than TabView as I didn't want the whole element to be re-drawn after each update.
 DynamicModule[{lab1 = "Label One", lab2 = "Two", lab3},
    Dynamic[lab1] ->
       InputField[Dynamic[lab1], String,
        FieldHint -> "Label for first tab"],
       InputField[Dynamic[lab2], String,
        FieldHint -> "Label for second tab"]}],
    Dynamic[lab2] ->
     Plot[x^lab3, {x, 0, 5}],
     {lab3, 1, 10}, LocalizeVariables -> False],
   Dynamic[lab3] -> "hey"
POSTED BY: Martin Hadley
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract