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.

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
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 also.so because of that I am using DynamicModule. also I tried with Module still not get it.. –  subbu Feb 6 '13 at 5:33

Your Answer


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

Browse other questions tagged or ask your own question.