From e4bfd0ef5e80cf8bb7a73ff40dc8dcea63bc970c Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 1 Dec 2014 16:07:13 -0800 Subject: [PATCH] Fixed: issue when opening a popUpList of a CPComboBox. We now firstly open the panel and then we modify the content of the panel, this occured an issue with the rendering of the view --- AppKit/CPComboBox.j | 3 +-- AppKit/_CPPopUpList.j | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/AppKit/CPComboBox.j b/AppKit/CPComboBox.j index f313e38de..bfc7887ef 100644 --- a/AppKit/CPComboBox.j +++ b/AppKit/CPComboBox.j @@ -518,8 +518,6 @@ var CPComboBoxTextSubview = @"text", if (!_listDelegate) [self setListDelegate:[[_CPPopUpList alloc] initWithDataSource:self]]; - [self _selectMatchingItem]; - // Note the offset here is 1 less than the focus ring width because the outer edge // of the focus ring is very transparent and it looks better if the list is closer. if (CPComboBoxFocusRingWidth < 0) @@ -530,6 +528,7 @@ var CPComboBoxTextSubview = @"text", } [_listDelegate popUpRelativeToRect:[self _borderFrame] view:self offset:CPComboBoxFocusRingWidth - 1]; + [self _selectMatchingItem]; } /*! @ignore */ diff --git a/AppKit/_CPPopUpList.j b/AppKit/_CPPopUpList.j index 845768bd6..6ee4e1ff0 100644 --- a/AppKit/_CPPopUpList.j +++ b/AppKit/_CPPopUpList.j @@ -336,6 +336,11 @@ var ListColumnIdentifier = @"1"; if ([_panel isVisible]) return; + [self listWillPopUp]; + + [_panel _trapNextMouseDown]; + [[aView window] addChildWindow:_panel ordered:CPWindowAbove]; + var rowRect = [_tableView rectOfRow:[self numberOfRowsInTableView:_tableView] - 1], frame = CGRectMake(0, 0, MAX(_listWidth, CGRectGetWidth(aRect)), CGRectGetMaxY(rowRect)); @@ -346,11 +351,6 @@ var ListColumnIdentifier = @"1"; [_scrollView setFrameSize:CGSizeMakeCopy(frame.size)]; [_tableView setEnabled:[_dataSource numberOfItemsInList:self] > 0]; [self scrollItemAtIndexToTop:[_tableView selectedRow]]; - - [self listWillPopUp]; - - [_panel _trapNextMouseDown]; - [[aView window] addChildWindow:_panel ordered:CPWindowAbove]; } #pragma mark Setting Display Attributes