make tab selection/order work - RETEST ON ALL HOST PLATFORMS!

Retesting is crucial. I can not verify the modal dialog behaviour on OSX, as OSX forbids certain things. Also, I'm not sure if the fix for button-tab selection works on the other platfporms!