I wrote a function named Testing.
BeginPackage["TestPackage`"]
Testing[tabNames_] :=
(
DynamicModule[
{
tabIndex = 0,
displayPanel = 0
},
(
{
Column[{
(*Setter Bar Part*)
(
Dynamic[
SetterBar[
Dynamic[tabIndex],
(Table[(i -> tabNames[[i]]), {i, 1, Length[tabNames]}]),
{ImageSize -> {110, 50}}
]
]
),
(*Setter bar IS Closed here*)
(*middle Panel Part*)
Dynamic[
Panel[
displayPanel
]
]
}
], Dynamic[tabIndex]}(*Final PAnel IS Closed here*)
)
]
)
EndPackage[]
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?
DynamicModuleis a localization construct. You can't accessDynamicModulevariables from outside of the code contained inDynamicModule. You can't take aPartof aDynamicModuleand 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 theDynamicModuledocumentation in-product. – John Fultz Feb 5 at 15:27DynamicModulealso,but the problem was If you call that function 2 times and assign to 2 different variables. after assigning,If you click on anysetterButton.that same thing is applied on another variable also.so because of that I am usingDynamicModule. also I tried withModulestill not get it.. – subbu Feb 6 at 5:33