Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I wrote 2 functions names are BooleanTest and MainTest.The following code is below

 BooleanTest[enable_, backgroundList_] :=
  Table[
        (
            If[
                (SameQ[Part[enable, enableNo], False]),
                (Table[RGBColor[0.784, 0.796,0.816], {Length[Part[backgroundList, enableNo]]}]),
                (Table[White, {Length[Part[backgroundList, enableNo]]}])
                 ]
        ),
        {enableNo, 1, Length[enable]}
    ]
  (*Second function*)
   Options[MainTest] :=
    {
        backgrounds -> Table[RGBColor[0.784, 0.796, 0.816], {3}, {7}]
   };
  MainTest[firstNo_, LastNo_, enableList_, OptionsPattern[]] :=
  (
Module[
        {dummyBackgrounds = OptionValue[backgrounds]},
        (
                dummyBackgrounds = 
 Dynamic[(BooleanTest[Setting[enableList], 
     OptionValue[backgrounds]]), 
  TrackedSymbols :> {Setting[enableList]}];
                Dynamic[
                        {
                            Setting[Part[dummyBackgrounds, 1, 1]],
                            Setting[Part[dummyBackgrounds, 2, 1]],
                            Setting[Part[dummyBackgrounds, 3, 1]]
                        }
                    ]
                )
    ]
)

(Notebook Code)

first = 10; last = 20; enables = {False, False, False};

In my actual code,all the arguments of the MainTest are dynamically change.But here third argument only will change.

The first function returns colors depending upon the False position from the Third argument of the MainTest.

The first function,I am calling in my second function.But that function evaluates,whenever Third argument will change. and it returns updated [[1,1]],[[2,1]],[[3,1]]elements in a list form.

I am calling my second function in the following way.

 MainTest[first,last, Dynamic[enables]]

but it's not working,I guess TrackedSymbol code was wrong.

can anyone help me?

Fell free,If you want to edit my question.

Thank you..

share|improve this question
 
The error message you're getting is basically saying "you're trying to take the third part of a two part list". If you test the length of some of your expressions, you'll find that they have length 2. If you simplified your code to a minimum working example, you could explore the problem more easily... –  cormullion Apr 23 at 10:26
 
@cormullion I checked functions individually like,I evaluted my first function.it's working fine.But whenever I am calling first function from second,that time it's not working. –  subbu Apr 23 at 10:31
 
You should use DynamicModule[{dummyBackgrounds = ... and Dynamic[ dummyBackgrounds = BooleanTest[ .... –  Silvia Apr 23 at 11:13

1 Answer

Use like this in your program Part[Setting[dummyBackgrounds], 1, 1]

instead of Setting[Part[dummyBackgrounds, 1, 1]]]

share|improve this answer

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.