문제

I'm using a NSAlert to ask the user to enable Accessibility for assistive devices. Is it possible to have a button that does not close the NSAlert that I could use to just open the UniversalAccess prefpane ?

If not, I suppose I've to create myself that window.

Thx.

도움이 되었습니까?

해결책

Normally alerts close when any button is pressed. In Mac OS X 10.5 or later you can use setAccessoryView: to insert a custom view into the alert, which presumably can contain a button that does anything you want.

Note however that you can't specify where the accessory view goes. It might have a button in it but the button would show up in the middle of the window instead of along the bottom with the other buttons. (If you chose a different button style such as a square bevel for your custom button, it might look less out of place.) To have complete control over layout, you need to make your own alert window.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top