[Tex/LaTex] Can a beamer frame have both [containsverbatim] and hidden/shown block options?

beameroverlaysverbatim

Possible Duplicate:
\pause won't generate extra slides in a containsverbatim frame

I use lstlisting environments in my beamer frames, but I would also like to have blocks with showing/hidden options like <2>, <1-3>, etc. With the following code, only the first version of the frame is displayed (with only the first block). Is there a way to make the hidden/shown block options work when the [containsverbatim] option is active?

\begin{frame}[containsverbatim]

  \begin{block}{}
    \begin{lstlisting}
blah blah blah
    \end{lstlisting}
  \end{block}

  \begin{block}<2>{}
    \begin{lstlisting}
blah blah blah
    \end{lstlisting}
  \end{block}

\end{frame}

Best Answer

Of course you can combine verbatim material and overlay specifications in your frames; only some precautions must be taken: to use verbatim material in a frame, you have to add the option [fragile] to the frame environment (with verbatim material, the \frame command will not do); the \end{frame} line must be alone on a single line:

\documentclass{beamer}
\usepackage{listings}

\begin{document}

\begin{frame}[fragile]
\begin{block}{}
\begin{lstlisting}
blah blah blah
\end{lstlisting}
\end{block}

\begin{block}<2>{}
\begin{lstlisting}
blah blah blah
\end{lstlisting}
\end{block}
\end{frame}

\end{document}