したとき

when ... did; when ... happened

→ 為る
phrase Very common #1,321
when ... did; when ... happened したとき combines the past form した ("did") with とき ("time") and refers to the time when an action was completed. Depending on context, it can also mean "after doing ...". The form is neutral and can be used in both polite and informal sentences.
JA: 初めてキスしたときのこと、教えてよ。
EN: Tell me about the time you kissed someone for the first time.

戦争が勃発したときあなたはいくつでしたか

How old were you when the war broke out?

私たちがちょうど食事を始めようしたとき彼女が現れた

She showed up just as we were about to start eating.

私たちの船は入港したときいかだ同然であった

When our ship entered port, it was little more than a raft.

出かけようしたとき彼が訪ねてきた

He came to visit just as I was about to leave.

トム部屋からこっそり出ていこうしたとき捕まった

Tom was caught when he tried to sneak out of the room.

彼は私がちょうど家を出ようとしたときに到着した

He arrived just as I was about to leave the house.

彼女は出廷したとき王冠のようなものかぶっていた

When she appeared in court, she was wearing something that looked like a crown.

彼は学校を卒業したときもう就職決まっていた

By the time he graduated from school, he had already secured a job.

次の歌手登場したとき雨が降り出した

When the next singer came on, it started to rain.