문제

Is it possible to detect actions that tell my controller when the user is mousing (or otherwise perusing) the items in an NSPopUpButton? I only seem to be notified on a new selection and I'd like to be notified as the user is rolling over any item in the menu.

thanks

tom

도움이 되었습니까?

해결책

You could set your controller as the delegate of the NSPopUpButton's menu. You will then be sent -menu:willHighlightItem: delegate messages as the mouse tracks over the menu.

- (void)awakeFromNib
{
    [[popupButton menu] setDelegate:self];
}

- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
{
    if(menu == [popupButton menu])
    {
        //do something
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top