3 deleted 99 characters in body
source | link

I couldn't find a more descriptive title, but I guess an example will explain my problem.

I set up some customized Grid function including some additional functionalities which I control with custom Options. Additionally, I would like to change some of the standard Grid Options, e.g. always use Frame->All. Take the following working example:

Options[myGrid] = {Frame -> All, "Tooltip" -> False};
myGrid[content_, opts : OptionsPattern[]] :=
      Module[{con},
          If[OptionValue["Tooltip"],
            con = MapIndexed[Tooltip[#1, #2] &, content, {-1}],
            con = content];content
          Grid[];
    Grid[con,
      Sequence @@ con,
            Sequence @@ FilterRules[{opts}~Join~Options[myGrid], Options[Grid]]
              ]
             ]

defining an example content:

mat = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

We can test the behavior:

myGrid[mat]

Mathematica graphics

The custom "Tooltip" flag works as intended. Now I want to pass an Option to Grid, that has not been explicitely set in the above Options[myGrid] declaration.This eventually makes it through to the Grid, but produces an error message.

myGrid[mat, Background -> Blue]

Mathematica graphics

Mathematica graphics

To get rid of the errors I embed the Options from Grid into my custom function:

Options[myGrid] = Join[
                   Join[
    {Frame -> All, "Tooltip" -> False},
                       Options[Grid]
                      ];

Now, I can change the Grid Options without raising an error:

myGrid[mat, Background -> Green]

Mathematica graphics

but the custom setting Frame->All gets lost.

myGrid[mat, Frame -> All]

Mathematica graphics

Apparently, the default Frame->None setting for Grid overrules my custom setting. I banged my head against this problem for too long already, therefore my plea for your assistance.

I couldn't find a more descriptive title, but I guess an example will explain my problem.

I set up some customized Grid function including some additional functionalities which I control with custom Options. Additionally, I would like to change some of the standard Grid Options, e.g. always use Frame->All. Take the following working example:

Options[myGrid] = {Frame -> All, "Tooltip" -> False};
myGrid[content_, opts : OptionsPattern[]] :=
      Module[{con},
          If[OptionValue["Tooltip"],
            con = MapIndexed[Tooltip[#1, #2] &, content, {-1}],
            con = content];
          Grid[
            con,
            Sequence @@ FilterRules[{opts}~Join~Options[myGrid], Options[Grid]]
              ]
             ]

defining an example content:

mat = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

We can test the behavior:

myGrid[mat]

Mathematica graphics

The custom "Tooltip" flag works as intended. Now I want to pass an Option to Grid, that has not been explicitely set in the above Options[myGrid] declaration.This eventually makes it through to the Grid, but produces an error message.

myGrid[mat, Background -> Blue]

Mathematica graphics

Mathematica graphics

To get rid of the errors I embed the Options from Grid into my custom function:

Options[myGrid] = Join[
                       {Frame -> All, "Tooltip" -> False},
                       Options[Grid]
                      ];

Now, I can change the Grid Options without raising an error:

myGrid[mat, Background -> Green]

Mathematica graphics

but the custom setting Frame->All gets lost.

myGrid[mat, Frame -> All]

Mathematica graphics

Apparently, the default Frame->None setting for Grid overrules my custom setting. I banged my head against this problem for too long already, therefore my plea for your assistance.

I couldn't find a more descriptive title, but I guess an example will explain my problem.

I set up some customized Grid function including some additional functionalities which I control with custom Options. Additionally, I would like to change some of the standard Grid Options, e.g. always use Frame->All. Take the following working example:

Options[myGrid] = {Frame -> All, "Tooltip" -> False};
myGrid[content_, opts : OptionsPattern[]] :=
  Module[{con},
    If[OptionValue["Tooltip"],
      con = MapIndexed[Tooltip[#1, #2] &, content, {-1}],
      con = content
    ];
    Grid[con,
      Sequence @@ 
        FilterRules[{opts}~Join~Options[myGrid], Options[Grid]]
    ]
  ]

defining an example content:

mat = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

We can test the behavior:

myGrid[mat]

Mathematica graphics

The custom "Tooltip" flag works as intended. Now I want to pass an Option to Grid, that has not been explicitely set in the above Options[myGrid] declaration.This eventually makes it through to the Grid, but produces an error message.

myGrid[mat, Background -> Blue]

Mathematica graphics

Mathematica graphics

To get rid of the errors I embed the Options from Grid into my custom function:

Options[myGrid] = 
  Join[
    {Frame -> All, "Tooltip" -> False},
    Options[Grid]
  ];

Now, I can change the Grid Options without raising an error:

myGrid[mat, Background -> Green]

Mathematica graphics

but the custom setting Frame->All gets lost.

myGrid[mat, Frame -> All]

Mathematica graphics

Apparently, the default Frame->None setting for Grid overrules my custom setting. I banged my head against this problem for too long already, therefore my plea for your assistance.

    Tweeted twitter.com/#!/StackMma/status/307528356310704129
2 added 4 characters in body
source | link

I couldn't find a more descriptive title, but I guess an example will explain my problem.

I set up some customized Grid function including some additional functionalities which I control with custom Options. Additionally, I would like to change some of the standard Grid Options, e.g. always use Frame->All. Take the following working example:

Options[myGrid] = {Frame -> All, "Tooltip" -> False};
myGrid[content_, opts : OptionsPattern[]] :=
      Module[{con},
          If[OptionValue["Tooltip"],
            con = MapIndexed[Tooltip[#1, #2] &, content, {-1}],
            con = content];
          Grid[
            con,
            Sequence @@ FilterRules[{opts}~Join~Options[myGrid], Options[Grid]]
              ]
             ]

defining an example content:

mat = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

We can test the behavior:

myGrid[mat]

Mathematica graphics

The custom "Tooltip" flag works as intended. Now I want to pass an Option to Grid, that has not been explicitely set in the above Options[myGrid] declaration.This eventually makes it through to the Grid, but produces an error message.

myGrid[mat, Background -> Blue]

myGrid[mat, Background -> Blue]

Mathematica graphics

Mathematica graphics

To get rid of the errors I embed the Options from Grid into my custom function:

Options[myGrid] = Join[
                       {Frame -> All, "Tooltip" -> False},
                       Options[Grid]
                      ];

Now, I can change the Grid Options without raising an error:

myGrid[mat, Background -> Green]

Mathematica graphics

but the custom setting Frame->All gets lost.

myGrid[mat, Frame -> All]

Mathematica graphics

Apparently, the default Frame->None setting for Grid overrules my custom setting. I banged my head against this problem for too long already, therefore my plea for your assistance.

I couldn't find a more descriptive title, but I guess an example will explain my problem.

I set up some customized Grid function including some additional functionalities which I control with custom Options. Additionally, I would like to change some of the standard Grid Options, e.g. always use Frame->All. Take the following working example:

Options[myGrid] = {Frame -> All, "Tooltip" -> False};
myGrid[content_, opts : OptionsPattern[]] :=
      Module[{con},
          If[OptionValue["Tooltip"],
            con = MapIndexed[Tooltip[#1, #2] &, content, {-1}],
            con = content];
          Grid[
            con,
            Sequence @@ FilterRules[{opts}~Join~Options[myGrid], Options[Grid]]
              ]
             ]

defining an example content:

mat = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

We can test the behavior:

myGrid[mat]

Mathematica graphics

The custom "Tooltip" flag works as intended. Now I want to pass an Option to Grid, that has not been explicitely set in the above Options[myGrid] declaration.This eventually makes it through to the Grid, but produces an error message.

myGrid[mat, Background -> Blue]

Mathematica graphics

Mathematica graphics

To get rid of the errors I embed the Options from Grid into my custom function:

Options[myGrid] = Join[
                       {Frame -> All, "Tooltip" -> False},
                       Options[Grid]
                      ];

Now, I can change the Grid Options without raising an error:

myGrid[mat, Background -> Green]

Mathematica graphics

but the custom setting Frame->All gets lost.

myGrid[mat, Frame -> All]

Mathematica graphics

Apparently, the default Frame->None setting for Grid overrules my custom setting. I banged my head against this problem for too long already, therefore my plea for your assistance.

I couldn't find a more descriptive title, but I guess an example will explain my problem.

I set up some customized Grid function including some additional functionalities which I control with custom Options. Additionally, I would like to change some of the standard Grid Options, e.g. always use Frame->All. Take the following working example:

Options[myGrid] = {Frame -> All, "Tooltip" -> False};
myGrid[content_, opts : OptionsPattern[]] :=
      Module[{con},
          If[OptionValue["Tooltip"],
            con = MapIndexed[Tooltip[#1, #2] &, content, {-1}],
            con = content];
          Grid[
            con,
            Sequence @@ FilterRules[{opts}~Join~Options[myGrid], Options[Grid]]
              ]
             ]

defining an example content:

mat = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

We can test the behavior:

myGrid[mat]

Mathematica graphics

The custom "Tooltip" flag works as intended. Now I want to pass an Option to Grid, that has not been explicitely set in the above Options[myGrid] declaration.This eventually makes it through to the Grid, but produces an error message.

myGrid[mat, Background -> Blue]

Mathematica graphics

Mathematica graphics

To get rid of the errors I embed the Options from Grid into my custom function:

Options[myGrid] = Join[
                       {Frame -> All, "Tooltip" -> False},
                       Options[Grid]
                      ];

Now, I can change the Grid Options without raising an error:

myGrid[mat, Background -> Green]

Mathematica graphics

but the custom setting Frame->All gets lost.

myGrid[mat, Frame -> All]

Mathematica graphics

Apparently, the default Frame->None setting for Grid overrules my custom setting. I banged my head against this problem for too long already, therefore my plea for your assistance.

1
source | link

Function with custom Options and modified Options for built-in Symbols

I couldn't find a more descriptive title, but I guess an example will explain my problem.

I set up some customized Grid function including some additional functionalities which I control with custom Options. Additionally, I would like to change some of the standard Grid Options, e.g. always use Frame->All. Take the following working example:

Options[myGrid] = {Frame -> All, "Tooltip" -> False};
myGrid[content_, opts : OptionsPattern[]] :=
      Module[{con},
          If[OptionValue["Tooltip"],
            con = MapIndexed[Tooltip[#1, #2] &, content, {-1}],
            con = content];
          Grid[
            con,
            Sequence @@ FilterRules[{opts}~Join~Options[myGrid], Options[Grid]]
              ]
             ]

defining an example content:

mat = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

We can test the behavior:

myGrid[mat]

Mathematica graphics

The custom "Tooltip" flag works as intended. Now I want to pass an Option to Grid, that has not been explicitely set in the above Options[myGrid] declaration.This eventually makes it through to the Grid, but produces an error message.

myGrid[mat, Background -> Blue]

Mathematica graphics

Mathematica graphics

To get rid of the errors I embed the Options from Grid into my custom function:

Options[myGrid] = Join[
                       {Frame -> All, "Tooltip" -> False},
                       Options[Grid]
                      ];

Now, I can change the Grid Options without raising an error:

myGrid[mat, Background -> Green]

Mathematica graphics

but the custom setting Frame->All gets lost.

myGrid[mat, Frame -> All]

Mathematica graphics

Apparently, the default Frame->None setting for Grid overrules my custom setting. I banged my head against this problem for too long already, therefore my plea for your assistance.