Generalize tab and pane switching methods.