sindresorhus/Preferences

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Need a way to programmatically select tabs #8

MikeManzo posted onGitHub

With the following declaration, the ability to programmatically select a tab is hidden. private let tabViewController = PreferencesTabViewController()

I suggest we make the following changes/additions in PreferencesWindowController ...

public func showWindow(tabIndex: Int = 0) {
    if !window!.isVisible {
        window?.center()
    }

    if tabIndex >= 0 && tabIndex < tabViewController.tabView.numberOfTabViewItems {
        tabViewController.tabView.selectTabViewItem(at: tabIndex)
    }

    showWindow(self)
    NSApp.activate(ignoringOtherApps: true)
}

public func selectTab(tabIndex: Int) {
    if tabIndex >= 0 && tabIndex < tabViewController.tabView.numberOfTabViewItems {
        tabViewController.tabView.selectTabViewItem(at: tabIndex)
    }
}

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests