You can give to the window a pointer to a function and then wait for the window to call it when it receives an event; this is called, hum... "using callback functions"
Gape, o ka kwatobolotsa sengwe mo go Naledi; ke gore wa se itseela mme ya re Naledi a re o a gana, wa mo raya wa re, 'Dilo makwati .....'