tags:

views:

127

answers:

1

This is what I'm trying to do

    \begin{tikzpicture}
    [node distance = 1cm, auto,font=\footnotesize,
    % STYLES
    every node/.style={node distance=1.3cm},
    comment/.style={rectangle, inner sep= 5pt, text width=4cm, node distance=0.25cm, font=},
    module/.style={rectangle, drop shadow, draw, fill=black!10, inner sep=5pt, text width=3cm, text badly centered, minimum height=0.8cm, font=\bfseries\footnotesize\sffamily,rounded corners},
    selected/.style={fill=red!40}]

    \node [module] (nodeA) {node A};
    \node [module, below of=nodeA] (nodeA) {node B};

    \only<1>{
      \node [comment, text width=6cm, right=0.25 of nodeA] {short description of Node A};
      \node [comment, text width=6cm, right=0.25 of nodeB] {short description of Node B};
     }

    \only<2>{
      \node [selected] (nodeA) {};
      \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node A};
    }
    \only<3>{
      \node [selected] (nodeB) {};
      \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node B};
    }
    \end{tikzpicture}

The problem is

      \node [selected] (nodeB) {};

creates a new node, but I want it to apply the style for the existing node. Is there any way to do so?

Of course I could have copies of every node in selected state and not-selected state, but I really want to have a normal solution.

+2  A: 

I don't think you can do this the way you want to (assuming I understand the question correctly), because once a node is drawn, there's no way to change its appearance. I'd suggest using Beamer's \alt macro:

\alt<2>{\node[module,selected] at (nodeA) {node A};}{\node[module] at (nodeA) {node A};}
\alt<3>{\node[module,selected] at (nodeB) {node B};}{\node[module] at (nodeB) {node B};}
\node[comment,text width=6cm,right=0.25 of nodeA]{\alt<2>{short description}{long description}};
\node[comment,text width=6cm,right=0.25 of nodeB]{\alt<3>{short description}{long description}};

Or something like that (you might have to tinker with the semicolons to get it to work, I can't test that at the moment).

Another option would be to actually just draw a new node. If you include

\node[module,selected] at (nodeA) {node A};

inside \only<2>, that will draw a node that looks just like node A, except with a red background, at the same position at node A. The new node will cover up the original node A.

David Zaslavsky
Oh, that will help me heaps! I once had to draw a white box covering the bit of my figure I had to change and redraw what I wanted to get the result :)
Vivi