ココアでは、メニューが遅れたnsbuttonを作成したいと思います。つまり、クリックするとアクションメソッドが呼び出され、2秒間押された状態が続くと、nsmenuが表示されます。
これは、Xcodeツールバーにある[BuildActiveTarget]ボタンに似ています。
よろしく、
ダナラジ。
これはNSPopUpButtonです。アプリで作成する方法は次のとおりです。
NSToolbarItem* item = [[[NSToolbarItem alloc] initWithItemIdentifier:identifier] autorelease];
[item setLabel:label];
[item setPaletteLabel:label];
[item setToolTip:tooltip];
NSPopUpButton* button = [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 24) pullsDown:NO] autorelease];
NSMenu* menu = [button menu];
// insert code here, that adds NSMenuItems to the menu
[button setTarget:self];
[button setAction:@selector(menuAction:)];
[[button cell] setBezelStyle:NSTexturedRoundedBezelStyle];
[[button cell] setArrowPosition:NSPopUpArrowAtBottom];
[[button cell] setFont:[NSFont systemFontOfSize:14]];
[item setView:button];