So perhaps Cruz was flying under the radar, and people weren't thinking that he might do something dramatic. However, Cruz is Cruz, and he is a drama queen. His speech (per reports--I won't risk vomiting by watching it) was long and full of this usual appeals to righteous conservatism. The delegates, expecting an endorsement, were getting restless. Some started shouting for the endorsement. When Cruz finished the speech without giving an endorsement, he was widely and loudly booed.
It was interesting to me to read various speculations about this incident. Megan McArdle (whom I don't like) thinks that both Cruz and Trump will be hurt by this. Allahpundit at HotAir has a detailed analysis. Key people in Trump's campaign are going to wreak vengeance on Cruz, and it started with the show of him being vociferously booed. Today there are stories that Ted Cruz will be primaried for his senate seat.
I've read a bunch of opinions, and I can't remember them all. I certainly don't agree with those who think it was a masterful turn by Cruz, showing how he's brave and principled. It's certainly believable that Cruz was still angry over Trump's accusations against his wife and his father (the ludicrous story that Cruz's father was involved with Lee Harvey Oswald). I wouldn't forgive insults like that, but then I'm not an opportunist politician.
However, Cruz will suffer because he has again been aggressive and insufferable. He spit in the eye of the GOP delegates, and smiled as he walked away. He's done that before. (At a conference of Arab Christians, he ordered them to support Israel, and then ran out to thunderous booing.) With that kind of character flaw, Cruz will probably never round up enough support to win the presidency. Thank God for that!
Extras. All the links above are well worth reading. Here are a few others. The Federalist luvs Ted Cruz. Bernstein writes mostly about the chaos at the convention, but this is a great observation:
"Trump doesn't want to unite his party. He wants to bully it into submission. As Ted Cruz's performance showed, the Texas senator yields to no one in the bullying department."