Adds on_tab_selected

I believe this covers #430.


d'oh good catch