From fa2c56d4565a6278b188696e8572f9b0752ec455 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 5 Jan 2010 21:43:19 +0000 Subject: =?UTF-8?q?=E2=80=A2=20next=20step=20to=20improve=20the=20Query=20?= =?UTF-8?q?Favorites/History=20search=20field=20behaviour=20-=20=E2=86=91?= =?UTF-8?q?=20or=20=E2=86=93=20selects=20now=20immediately=20the=20next/pr?= =?UTF-8?q?ev=20menu=20item=20[many=20thanks=20to=20Rowan!]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CustomQuery.m | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'Source/CustomQuery.m') diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 2fec7d2f..c75172e0 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -3027,11 +3027,30 @@ if(commandSelector == @selector(moveDown:) || commandSelector == @selector(moveUp:)) { [queryHistorySearchField abortEditing]; [queryFavoritesSearchField abortEditing]; + + // Send moveDown/Up to the popup menu + NSEvent *arrowEvent; + if(commandSelector == @selector(moveDown:)) + arrowEvent = [NSEvent keyEventWithType:NSKeyDown location:NSMakePoint(0,0) modifierFlags:0 timestamp:0 windowNumber:[tableWindow windowNumber] context:[NSGraphicsContext currentContext] characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:0x7D]; + else + arrowEvent = [NSEvent keyEventWithType:NSKeyDown location:NSMakePoint(0,0) modifierFlags:0 timestamp:0 windowNumber:[tableWindow windowNumber] context:[NSGraphicsContext currentContext] characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:0x7E]; + [[NSApplication sharedApplication] postEvent:arrowEvent atStart:NO]; return YES; + } } return NO; } +// - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item +// { +// // Set the focus at the search field +// // TODO : but no way out; always selecting first/last menu item +// // because after setting focus to search field NSMenu selectedItemIndex is -1 +// if(item == queryHistorySearchMenuItem) { +// [queryHistorySearchField selectText:nil]; +// } +// +// } /** * Setup various interface controls. @@ -3041,7 +3060,7 @@ // Set pre-defined menu tags [queryFavoritesSaveAsMenuItem setTag:SP_SAVE_SELECTION_FAVORTITE_MENUITEM_TAG]; [queryFavoritesSaveAllMenuItem setTag:SP_SAVE_ALL_FAVORTITE_MENUITEM_TAG]; - + // Set the structure and index view's vertical gridlines if required [customQueryView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; -- cgit v1.2.3