Only set table view’s row height during sizeToFit

The initial dimension of the OakChoiceMenu could be incorrect because the row height had not been updated.

This broke in c270b0c5af
This commit is contained in:
Allan Odgaard
2016-09-12 08:46:26 +02:00
parent 553e89ceb6
commit 7b291185fe

View File

@@ -43,6 +43,8 @@ enum action_t { kActionNop, kActionTab, kActionReturn, kActionCancel, kActionMov
CGFloat const kScrollBarWidth = 15;
NSTextField* textField = OakCreateLabel(@"", self.font, NSLeftTextAlignment, NSLineBreakByTruncatingTail);
tableView.rowHeight = NSHeight(textField.frame);
CGFloat width = 60;
for(NSInteger i = 0; i < MIN(_choices.count, 256); ++i)
{
@@ -127,8 +129,6 @@ enum action_t { kActionNop, kActionTab, kActionReturn, kActionCancel, kActionMov
if(!res)
{
res = OakCreateLabel(@"", self.font, NSLeftTextAlignment, NSLineBreakByTruncatingTail);
[res sizeToFit];
aTableView.rowHeight = NSHeight(res.frame);
res.identifier = identifier;
}
return res;