Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a function named Testing.

Testing[tabNames_] :=
                            tabIndex = 0,
                            displayPanel = 0
                                    (*Setter Bar Part*)
                                                          (Table[(i -> tabNames[[i]]), {i, 1, Length[tabNames]}]),
                                                          {ImageSize -> {110, 50}}
                                (*Setter bar IS Closed here*)
                                (*middle Panel Part*)

                            ], Dynamic[tabIndex]}(*Final PAnel IS Closed here*)

I saved the above code in .m file.

.nb file code

   functionCalling = Testing[{a, b, c, d}];
   notebookList = {1, 2, 3, 4, 5};
   TestPackage`displayPanel =Dynamic[(Part[notebookList, (TestPackage`tabIndex + 1)])];
   Dynamic[Part[functionCalling, 2, 1]]

I want to track the TabIndex value dynamically,If you click on any setterButton.

depending upon the TabIndexvalue,I will find the element from the notebookList and assign to displayPanel.

after assignment,the updated displayPanel value should be displayed dynamically in notebook.

for this purpose,I wrote the above code in a .nb file.But that code is not working

How can I solve this issue?

Please help me?

share|improve this question

closed as off-topic by Kuba, Karsten 7., ciao, Jens, bbgodfrey Mar 29 '15 at 4:29

  • The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

I started to answer this, but I gave up because the bad assumptions are just too deeply ingrained in the question. DynamicModule is a localization construct. You can't access DynamicModule variables from outside of the code contained in DynamicModule. You can't take a Part of a DynamicModule and expect it to make any kind of sense. If you haven't, you should really read all of the documentation linked to from the Tutorials drop-down of the DynamicModule documentation in-product. – John Fultz Feb 5 '13 at 15:27
I tried without DynamicModule also,but the problem was If you call that function 2 times and assign to 2 different variables. after assigning,If you click on any setterButton.that same thing is applied on another variable because of that I am using DynamicModule. also I tried with Module still not get it.. – subbu Feb 6 '13 at 5:33
I'm voting to close this question as off-topic because John Fultz says it is too bad. :) (but seriously - old and to localized*) – Kuba Mar 29 '15 at 0:15